* [PATCH] NFS/pnfs: Fix the error path in pnfs_layoutreturn_retry_later_locked()
@ 2025-05-11 13:28 trondmy
2025-05-11 20:59 ` kernel test robot
0 siblings, 1 reply; 2+ messages in thread
From: trondmy @ 2025-05-11 13:28 UTC (permalink / raw)
To: linux-nfs
From: Trond Myklebust <trond.myklebust@hammerspace.com>
If there isn't a valid layout, or the layout stateid has changed, the
cleanup after a layout return should clear out the old data.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
fs/nfs/pnfs.c | 30 +++++++++++++-----------------
1 file changed, 13 insertions(+), 17 deletions(-)
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index fc7c5fb10198..3adb7d0dbec7 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1254,21 +1254,15 @@ static void pnfs_clear_layoutcommit(struct inode *inode,
static void
pnfs_layoutreturn_retry_later_locked(struct pnfs_layout_hdr *lo,
const nfs4_stateid *arg_stateid,
- const struct pnfs_layout_range *range)
+ const struct pnfs_layout_range *range,
+ struct list_head *freeme)
{
- const struct pnfs_layout_segment *lseg;
- u32 seq = be32_to_cpu(arg_stateid->seqid);
-
if (pnfs_layout_is_valid(lo) &&
- nfs4_stateid_match_other(&lo->plh_stateid, arg_stateid)) {
- list_for_each_entry(lseg, &lo->plh_return_segs, pls_list) {
- if (pnfs_seqid_is_newer(lseg->pls_seq, seq) ||
- !pnfs_should_free_range(&lseg->pls_range, range))
- continue;
- pnfs_set_plh_return_info(lo, range->iomode, seq);
- break;
- }
- }
+ nfs4_stateid_match_other(&lo->plh_stateid, arg_stateid))
+ pnfs_reset_return_info(lo);
+ else
+ pnfs_mark_layout_stateid_invalid(lo, freeme);
+ pnfs_clear_layoutreturn_waitbit(lo);
}
void pnfs_layoutreturn_retry_later(struct pnfs_layout_hdr *lo,
@@ -1276,11 +1270,12 @@ void pnfs_layoutreturn_retry_later(struct pnfs_layout_hdr *lo,
const struct pnfs_layout_range *range)
{
struct inode *inode = lo->plh_inode;
+ LIST_HEAD(freeme);
spin_lock(&inode->i_lock);
- pnfs_layoutreturn_retry_later_locked(lo, arg_stateid, range);
- pnfs_clear_layoutreturn_waitbit(lo);
+ pnfs_layoutreturn_retry_later_locked(lo, arg_stateid, range, &freeme);
spin_unlock(&inode->i_lock);
+ pnfs_free_lseg_list(&freeme);
}
void pnfs_layoutreturn_free_lsegs(struct pnfs_layout_hdr *lo,
@@ -1716,6 +1711,7 @@ void pnfs_roc_release(struct nfs4_layoutreturn_args *args,
struct inode *inode = args->inode;
const nfs4_stateid *res_stateid = NULL;
struct nfs4_xdr_opaque_data *ld_private = args->ld_private;
+ LIST_HEAD(freeme);
switch (ret) {
case -NFS4ERR_BADSESSION:
@@ -1724,9 +1720,9 @@ void pnfs_roc_release(struct nfs4_layoutreturn_args *args,
case -NFS4ERR_NOMATCHING_LAYOUT:
spin_lock(&inode->i_lock);
pnfs_layoutreturn_retry_later_locked(lo, &args->stateid,
- &args->range);
- pnfs_clear_layoutreturn_waitbit(lo);
+ &args->range, &freeme);
spin_unlock(&inode->i_lock);
+ pnfs_free_lseg_list(&freeme);
break;
case 0:
if (res->lrs_present)
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] NFS/pnfs: Fix the error path in pnfs_layoutreturn_retry_later_locked()
2025-05-11 13:28 [PATCH] NFS/pnfs: Fix the error path in pnfs_layoutreturn_retry_later_locked() trondmy
@ 2025-05-11 20:59 ` kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-05-11 20:59 UTC (permalink / raw)
To: trondmy, linux-nfs; +Cc: oe-kbuild-all
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on trondmy-nfs/linux-next]
[also build test ERROR on linus/master v6.15-rc5 next-20250509]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/trondmy-kernel-org/NFS-pnfs-Fix-the-error-path-in-pnfs_layoutreturn_retry_later_locked/20250511-212905
base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
patch link: https://lore.kernel.org/r/7a4abcb32bb29ad463638bf1d2d0600a3d9e357c.1746970073.git.trond.myklebust%40hammerspace.com
patch subject: [PATCH] NFS/pnfs: Fix the error path in pnfs_layoutreturn_retry_later_locked()
config: sh-allyesconfig (https://download.01.org/0day-ci/archive/20250512/202505120404.RyxNoBfS-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250512/202505120404.RyxNoBfS-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505120404.RyxNoBfS-lkp@intel.com/
All errors (new ones prefixed by >>):
fs/nfs/pnfs.c: In function 'pnfs_layoutreturn_retry_later_locked':
>> fs/nfs/pnfs.c:1254:17: error: implicit declaration of function 'pnfs_reset_return_info'; did you mean 'pnfs_set_plh_return_info'? [-Wimplicit-function-declaration]
1254 | pnfs_reset_return_info(lo);
| ^~~~~~~~~~~~~~~~~~~~~~
| pnfs_set_plh_return_info
vim +1254 fs/nfs/pnfs.c
1245
1246 static void
1247 pnfs_layoutreturn_retry_later_locked(struct pnfs_layout_hdr *lo,
1248 const nfs4_stateid *arg_stateid,
1249 const struct pnfs_layout_range *range,
1250 struct list_head *freeme)
1251 {
1252 if (pnfs_layout_is_valid(lo) &&
1253 nfs4_stateid_match_other(&lo->plh_stateid, arg_stateid))
> 1254 pnfs_reset_return_info(lo);
1255 else
1256 pnfs_mark_layout_stateid_invalid(lo, freeme);
1257 pnfs_clear_layoutreturn_waitbit(lo);
1258 }
1259
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-11 21:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-11 13:28 [PATCH] NFS/pnfs: Fix the error path in pnfs_layoutreturn_retry_later_locked() trondmy
2025-05-11 20:59 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox