Linux NFS development
 help / color / mirror / Atom feed
* [PATCH] pNFS/flexfiles: don't attempt pnfs on fatal DS errors
@ 2025-06-26  9:12 Tigran Mkrtchyan
  2025-06-26 23:42 ` kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: Tigran Mkrtchyan @ 2025-06-26  9:12 UTC (permalink / raw)
  To: linux-nfs
  Cc: Trond Myklebust, Anna Schumaker, root max-exfl020,
	Tigran Mkrtchyan

From: root max-exfl020 <root@max-exfl020.desy.de>

Fixes: 260f32adb88 ("pNFS/flexfiles: Check the result of nfs4_pnfs_ds_connect")

When an applications get killed (SIGTERM/SIGINT) while pNFS client performs a connection
to DS, client ends in an infinite loop of connect-disconnect. This
source of the issue, it that flexfilelayoutdev#nfs4_ff_layout_prepare_ds gets an error
on nfs4_pnfs_ds_connect with status ERESTARTSYS, which is set by rpc_signal_task, but
the error is treated as transient, thus retried.

The issue is reproducible with Ctrl+C the following script(there should be ~1000 files in
a directory, client should must not have any connections to DSes):

```
echo 3 > /proc/sys/vm/drop_caches

for i in *
do
   head -1 $i
done
```

The change aims to propagate the nfs4_ff_layout_prepare_ds error state
to the caller that can decide whatever this is a retryable error or not.

Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
---
 fs/nfs/flexfilelayout/flexfilelayout.c    | 26 ++++++++++++++---------
 fs/nfs/flexfilelayout/flexfilelayoutdev.c |  4 ++--
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 708cbfbccea5..a67001b4dbdf 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -762,14 +762,14 @@ ff_layout_choose_ds_for_read(struct pnfs_layout_segment *lseg,
 {
 	struct nfs4_ff_layout_segment *fls = FF_LAYOUT_LSEG(lseg);
 	struct nfs4_ff_layout_mirror *mirror;
-	struct nfs4_pnfs_ds *ds;
+	struct nfs4_pnfs_ds *ds = ERR_PTR(-EAGAIN);
 	u32 idx;
 
 	/* mirrors are initially sorted by efficiency */
 	for (idx = start_idx; idx < fls->mirror_array_cnt; idx++) {
 		mirror = FF_LAYOUT_COMP(lseg, idx);
 		ds = nfs4_ff_layout_prepare_ds(lseg, mirror, false);
-		if (!ds)
+		if (IS_ERR(ds))
 			continue;
 
 		if (check_device &&
@@ -777,10 +777,10 @@ ff_layout_choose_ds_for_read(struct pnfs_layout_segment *lseg,
 			continue;
 
 		*best_idx = idx;
-		return ds;
+		break;
 	}
 
-	return NULL;
+	return ds;
 }
 
 static struct nfs4_pnfs_ds *
@@ -942,7 +942,7 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
 	for (i = 0; i < pgio->pg_mirror_count; i++) {
 		mirror = FF_LAYOUT_COMP(pgio->pg_lseg, i);
 		ds = nfs4_ff_layout_prepare_ds(pgio->pg_lseg, mirror, true);
-		if (!ds) {
+		if (IS_ERR(ds)) {
 			if (!ff_layout_no_fallback_to_mds(pgio->pg_lseg))
 				goto out_mds;
 			pnfs_generic_pg_cleanup(pgio);
@@ -1808,6 +1808,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr)
 	u32 idx = hdr->pgio_mirror_idx;
 	int vers;
 	struct nfs_fh *fh;
+	bool ds_fatal_error = false;
 
 	dprintk("--> %s ino %lu pgbase %u req %zu@%llu\n",
 		__func__, hdr->inode->i_ino,
@@ -1815,8 +1816,10 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr)
 
 	mirror = FF_LAYOUT_COMP(lseg, idx);
 	ds = nfs4_ff_layout_prepare_ds(lseg, mirror, false);
-	if (!ds)
+	if (IS_ERR(ds)) {
+		ds_fatal_error = nfs_error_is_fatal(PTR_ERR(ds));
 		goto out_failed;
+	}
 
 	ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp,
 						   hdr->inode);
@@ -1864,7 +1867,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr)
 	return PNFS_ATTEMPTED;
 
 out_failed:
-	if (ff_layout_avoid_mds_available_ds(lseg))
+	if (ff_layout_avoid_mds_available_ds(lseg) && !ds_fatal_error)
 		return PNFS_TRY_AGAIN;
 	trace_pnfs_mds_fallback_read_pagelist(hdr->inode,
 			hdr->args.offset, hdr->args.count,
@@ -1886,11 +1889,14 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
 	int vers;
 	struct nfs_fh *fh;
 	u32 idx = hdr->pgio_mirror_idx;
+	bool ds_fatal_error = false;
 
 	mirror = FF_LAYOUT_COMP(lseg, idx);
 	ds = nfs4_ff_layout_prepare_ds(lseg, mirror, true);
-	if (!ds)
+	if (IS_ERR(ds)) {
+		ds_fatal_error = nfs_error_is_fatal(PTR_ERR(ds));
 		goto out_failed;
+	}
 
 	ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp,
 						   hdr->inode);
@@ -1941,7 +1947,7 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
 	return PNFS_ATTEMPTED;
 
 out_failed:
-	if (ff_layout_avoid_mds_available_ds(lseg))
+	if (ff_layout_avoid_mds_available_ds(lseg) && !ds_fatal_error)
 		return PNFS_TRY_AGAIN;
 	trace_pnfs_mds_fallback_write_pagelist(hdr->inode,
 			hdr->args.offset, hdr->args.count,
@@ -1984,7 +1990,7 @@ static int ff_layout_initiate_commit(struct nfs_commit_data *data, int how)
 	idx = calc_ds_index_from_commit(lseg, data->ds_commit_index);
 	mirror = FF_LAYOUT_COMP(lseg, idx);
 	ds = nfs4_ff_layout_prepare_ds(lseg, mirror, true);
-	if (!ds)
+	if (IS_ERR(ds))
 		goto out_err;
 
 	ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp,
diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
index 4a304cf17c4b..73275a9d74c0 100644
--- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
+++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
@@ -370,7 +370,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
 			  struct nfs4_ff_layout_mirror *mirror,
 			  bool fail_return)
 {
-	struct nfs4_pnfs_ds *ds = NULL;
+	struct nfs4_pnfs_ds *ds = ERR_PTR(-EAGAIN);
 	struct inode *ino = lseg->pls_layout->plh_inode;
 	struct nfs_server *s = NFS_SERVER(ino);
 	unsigned int max_payload;
@@ -418,7 +418,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
 	ff_layout_send_layouterror(lseg);
 	if (fail_return || !ff_layout_has_available_ds(lseg))
 		pnfs_error_mark_layout_for_return(ino, lseg);
-	ds = NULL;
+	ds = ERR_PTR(status);
 out:
 	return ds;
 }
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pNFS/flexfiles: don't attempt pnfs on fatal DS errors
  2025-06-26  9:12 [PATCH] pNFS/flexfiles: don't attempt pnfs on fatal DS errors Tigran Mkrtchyan
@ 2025-06-26 23:42 ` kernel test robot
  2025-06-27  6:37   ` Mkrtchyan, Tigran
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2025-06-26 23:42 UTC (permalink / raw)
  To: Tigran Mkrtchyan, linux-nfs
  Cc: llvm, oe-kbuild-all, Trond Myklebust, Anna Schumaker,
	root max-exfl020, Tigran Mkrtchyan

Hi Tigran,

kernel test robot noticed the following build warnings:

[auto build test WARNING on trondmy-nfs/linux-next]
[also build test WARNING on linus/master v6.16-rc3 next-20250626]
[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/Tigran-Mkrtchyan/pNFS-flexfiles-don-t-attempt-pnfs-on-fatal-DS-errors/20250626-171336
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
patch link:    https://lore.kernel.org/r/20250626091202.130567-1-tigran.mkrtchyan%40desy.de
patch subject: [PATCH] pNFS/flexfiles: don't attempt pnfs on fatal DS errors
config: i386-buildonly-randconfig-005-20250627 (https://download.01.org/0day-ci/archive/20250627/202506270701.wUk38xC4-lkp@intel.com/config)
compiler: clang version 20.1.7 (https://github.com/llvm/llvm-project 6146a88f60492b520a36f8f8f3231e15f3cc6082)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250627/202506270701.wUk38xC4-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/202506270701.wUk38xC4-lkp@intel.com/

All warnings (new ones prefixed by >>):

   fs/nfs/flexfilelayout/flexfilelayoutdev.c:56:9: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
      56 |         int i, ret = -ENOMEM;
         |                ^
>> fs/nfs/flexfilelayout/flexfilelayoutdev.c:379:6: warning: variable 'status' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     379 |         if (!ff_layout_init_mirror_ds(lseg->pls_layout, mirror))
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/nfs/flexfilelayout/flexfilelayoutdev.c:421:15: note: uninitialized use occurs here
     421 |         ds = ERR_PTR(status);
         |                      ^~~~~~
   fs/nfs/flexfilelayout/flexfilelayoutdev.c:379:2: note: remove the 'if' if its condition is always false
     379 |         if (!ff_layout_init_mirror_ds(lseg->pls_layout, mirror))
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     380 |                 goto noconnect;
         |                 ~~~~~~~~~~~~~~
   fs/nfs/flexfilelayout/flexfilelayoutdev.c:377:12: note: initialize the variable 'status' to silence this warning
     377 |         int status;
         |                   ^
         |                    = 0
   2 warnings generated.


vim +379 fs/nfs/flexfilelayout/flexfilelayoutdev.c

cefa587a40bb53 Trond Myklebust       2019-02-28  350  
95e2b7e95d43c5 Jeff Layton           2016-05-17  351  /**
95e2b7e95d43c5 Jeff Layton           2016-05-17  352   * nfs4_ff_layout_prepare_ds - prepare a DS connection for an RPC call
95e2b7e95d43c5 Jeff Layton           2016-05-17  353   * @lseg: the layout segment we're operating on
2444ff277a686d Trond Myklebust       2019-02-14  354   * @mirror: layout mirror describing the DS to use
95e2b7e95d43c5 Jeff Layton           2016-05-17  355   * @fail_return: return layout on connect failure?
95e2b7e95d43c5 Jeff Layton           2016-05-17  356   *
95e2b7e95d43c5 Jeff Layton           2016-05-17  357   * Try to prepare a DS connection to accept an RPC call. This involves
95e2b7e95d43c5 Jeff Layton           2016-05-17  358   * selecting a mirror to use and connecting the client to it if it's not
95e2b7e95d43c5 Jeff Layton           2016-05-17  359   * already connected.
95e2b7e95d43c5 Jeff Layton           2016-05-17  360   *
95e2b7e95d43c5 Jeff Layton           2016-05-17  361   * Since we only need a single functioning mirror to satisfy a read, we don't
95e2b7e95d43c5 Jeff Layton           2016-05-17  362   * want to return the layout if there is one. For writes though, any down
95e2b7e95d43c5 Jeff Layton           2016-05-17  363   * mirror should result in a LAYOUTRETURN. @fail_return is how we distinguish
95e2b7e95d43c5 Jeff Layton           2016-05-17  364   * between the two cases.
95e2b7e95d43c5 Jeff Layton           2016-05-17  365   *
95e2b7e95d43c5 Jeff Layton           2016-05-17  366   * Returns a pointer to a connected DS object on success or NULL on failure.
95e2b7e95d43c5 Jeff Layton           2016-05-17  367   */
d67ae825a59d63 Tom Haynes            2014-12-11  368  struct nfs4_pnfs_ds *
2444ff277a686d Trond Myklebust       2019-02-14  369  nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
2444ff277a686d Trond Myklebust       2019-02-14  370  			  struct nfs4_ff_layout_mirror *mirror,
d67ae825a59d63 Tom Haynes            2014-12-11  371  			  bool fail_return)
d67ae825a59d63 Tom Haynes            2014-12-11  372  {
6468b866bac7de root max-exfl020      2025-06-26  373  	struct nfs4_pnfs_ds *ds = ERR_PTR(-EAGAIN);
d67ae825a59d63 Tom Haynes            2014-12-11  374  	struct inode *ino = lseg->pls_layout->plh_inode;
d67ae825a59d63 Tom Haynes            2014-12-11  375  	struct nfs_server *s = NFS_SERVER(ino);
d67ae825a59d63 Tom Haynes            2014-12-11  376  	unsigned int max_payload;
a33e4b036d4612 Weston Andros Adamson 2017-03-09  377  	int status;
d67ae825a59d63 Tom Haynes            2014-12-11  378  
cefa587a40bb53 Trond Myklebust       2019-02-28 @379  	if (!ff_layout_init_mirror_ds(lseg->pls_layout, mirror))
0a156dd58274b0 Trond Myklebust       2019-02-27  380  		goto noconnect;
d67ae825a59d63 Tom Haynes            2014-12-11  381  
d67ae825a59d63 Tom Haynes            2014-12-11  382  	ds = mirror->mirror_ds->ds;
a2915fa06227b0 Baptiste Lepers       2021-09-06  383  	if (READ_ONCE(ds->ds_clp))
a2915fa06227b0 Baptiste Lepers       2021-09-06  384  		goto out;
d67ae825a59d63 Tom Haynes            2014-12-11  385  	/* matching smp_wmb() in _nfs4_pnfs_v3/4_ds_connect */
d67ae825a59d63 Tom Haynes            2014-12-11  386  	smp_rmb();
d67ae825a59d63 Tom Haynes            2014-12-11  387  
d67ae825a59d63 Tom Haynes            2014-12-11  388  	/* FIXME: For now we assume the server sent only one version of NFS
d67ae825a59d63 Tom Haynes            2014-12-11  389  	 * to use for the DS.
d67ae825a59d63 Tom Haynes            2014-12-11  390  	 */
2444ff277a686d Trond Myklebust       2019-02-14  391  	status = nfs4_pnfs_ds_connect(s, ds, &mirror->mirror_ds->id_node,
2444ff277a686d Trond Myklebust       2019-02-14  392  			     dataserver_timeo, dataserver_retrans,
d67ae825a59d63 Tom Haynes            2014-12-11  393  			     mirror->mirror_ds->ds_versions[0].version,
7d38de3ffa75f9 Anna Schumaker        2016-11-17  394  			     mirror->mirror_ds->ds_versions[0].minor_version);
d67ae825a59d63 Tom Haynes            2014-12-11  395  
d67ae825a59d63 Tom Haynes            2014-12-11  396  	/* connect success, check rsize/wsize limit */
260f32adb88dad Trond Myklebust       2017-04-20  397  	if (!status) {
d488b9d01fbc2f Trond Myklebust       2024-09-05  398  		/*
d488b9d01fbc2f Trond Myklebust       2024-09-05  399  		 * ds_clp is put in destroy_ds().
d488b9d01fbc2f Trond Myklebust       2024-09-05  400  		 * keep ds_clp even if DS is local, so that if local IO cannot
d488b9d01fbc2f Trond Myklebust       2024-09-05  401  		 * proceed somehow, we can fall back to NFS whenever we want.
d488b9d01fbc2f Trond Myklebust       2024-09-05  402  		 */
1ff4716f420b5a Mike Snitzer          2025-05-13  403  		nfs_local_probe_async(ds->ds_clp);
d67ae825a59d63 Tom Haynes            2014-12-11  404  		max_payload =
d67ae825a59d63 Tom Haynes            2014-12-11  405  			nfs_block_size(rpc_max_payload(ds->ds_clp->cl_rpcclient),
d67ae825a59d63 Tom Haynes            2014-12-11  406  				       NULL);
d67ae825a59d63 Tom Haynes            2014-12-11  407  		if (mirror->mirror_ds->ds_versions[0].rsize > max_payload)
d67ae825a59d63 Tom Haynes            2014-12-11  408  			mirror->mirror_ds->ds_versions[0].rsize = max_payload;
d67ae825a59d63 Tom Haynes            2014-12-11  409  		if (mirror->mirror_ds->ds_versions[0].wsize > max_payload)
d67ae825a59d63 Tom Haynes            2014-12-11  410  			mirror->mirror_ds->ds_versions[0].wsize = max_payload;
3dc147359e3dcd Trond Myklebust       2016-08-29  411  		goto out;
3dc147359e3dcd Trond Myklebust       2016-08-29  412  	}
0a156dd58274b0 Trond Myklebust       2019-02-27  413  noconnect:
d67ae825a59d63 Tom Haynes            2014-12-11  414  	ff_layout_track_ds_error(FF_LAYOUT_FROM_HDR(lseg->pls_layout),
d67ae825a59d63 Tom Haynes            2014-12-11  415  				 mirror, lseg->pls_range.offset,
d67ae825a59d63 Tom Haynes            2014-12-11  416  				 lseg->pls_range.length, NFS4ERR_NXIO,
d67ae825a59d63 Tom Haynes            2014-12-11  417  				 OP_ILLEGAL, GFP_NOIO);
f0922a6c0cdb92 Trond Myklebust       2019-02-10  418  	ff_layout_send_layouterror(lseg);
094069f1d96f69 Jeff Layton           2016-05-17  419  	if (fail_return || !ff_layout_has_available_ds(lseg))
d67ae825a59d63 Tom Haynes            2014-12-11  420  		pnfs_error_mark_layout_for_return(ino, lseg);
6468b866bac7de root max-exfl020      2025-06-26  421  	ds = ERR_PTR(status);
d67ae825a59d63 Tom Haynes            2014-12-11  422  out:
d67ae825a59d63 Tom Haynes            2014-12-11  423  	return ds;
d67ae825a59d63 Tom Haynes            2014-12-11  424  }
d67ae825a59d63 Tom Haynes            2014-12-11  425  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pNFS/flexfiles: don't attempt pnfs on fatal DS errors
  2025-06-26 23:42 ` kernel test robot
@ 2025-06-27  6:37   ` Mkrtchyan, Tigran
  0 siblings, 0 replies; 3+ messages in thread
From: Mkrtchyan, Tigran @ 2025-06-27  6:37 UTC (permalink / raw)
  To: kernel test robot
  Cc: linux-nfs, llvm, oe-kbuild-all, Trond Myklebust, Anna Schumaker

[-- Attachment #1: Type: text/plain, Size: 10394 bytes --]

Thank you, robot!

----- Original Message -----
> From: "kernel test robot" <lkp@intel.com>
> To: "Tigran Mkrtchyan" <tigran.mkrtchyan@desy.de>, "linux-nfs" <linux-nfs@vger.kernel.org>
> Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev, "Trond Myklebust" <trondmy@kernel.org>, "Anna Schumaker"
> <anna@kernel.org>, "root max-exfl020" <root@max-exfl020.desy.de>, "Tigran Mkrtchyan" <tigran.mkrtchyan@desy.de>
> Sent: Friday, 27 June, 2025 01:42:33
> Subject: Re: [PATCH] pNFS/flexfiles: don't attempt pnfs on fatal DS errors

> Hi Tigran,
> 
> kernel test robot noticed the following build warnings:
> 
> [auto build test WARNING on trondmy-nfs/linux-next]
> [also build test WARNING on linus/master v6.16-rc3 next-20250626]
> [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/Tigran-Mkrtchyan/pNFS-flexfiles-don-t-attempt-pnfs-on-fatal-DS-errors/20250626-171336
> base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
> patch link:
> https://lore.kernel.org/r/20250626091202.130567-1-tigran.mkrtchyan%40desy.de
> patch subject: [PATCH] pNFS/flexfiles: don't attempt pnfs on fatal DS errors
> config: i386-buildonly-randconfig-005-20250627
> (https://download.01.org/0day-ci/archive/20250627/202506270701.wUk38xC4-lkp@intel.com/config)
> compiler: clang version 20.1.7 (https://github.com/llvm/llvm-project
> 6146a88f60492b520a36f8f8f3231e15f3cc6082)
> reproduce (this is a W=1 build):
> (https://download.01.org/0day-ci/archive/20250627/202506270701.wUk38xC4-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/202506270701.wUk38xC4-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
>   fs/nfs/flexfilelayout/flexfilelayoutdev.c:56:9: warning: variable 'ret' set but
>   not used [-Wunused-but-set-variable]
>      56 |         int i, ret = -ENOMEM;
>         |                ^
>>> fs/nfs/flexfilelayout/flexfilelayoutdev.c:379:6: warning: variable 'status' is
>>> used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
>     379 |         if (!ff_layout_init_mirror_ds(lseg->pls_layout, mirror))
>         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   fs/nfs/flexfilelayout/flexfilelayoutdev.c:421:15: note: uninitialized use occurs
>   here
>     421 |         ds = ERR_PTR(status);
>         |                      ^~~~~~
>   fs/nfs/flexfilelayout/flexfilelayoutdev.c:379:2: note: remove the 'if' if its
>   condition is always false
>     379 |         if (!ff_layout_init_mirror_ds(lseg->pls_layout, mirror))
>         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     380 |                 goto noconnect;
>         |                 ~~~~~~~~~~~~~~
>   fs/nfs/flexfilelayout/flexfilelayoutdev.c:377:12: note: initialize the variable
>   'status' to silence this warning
>     377 |         int status;
>         |                   ^
>         |                    = 0
>   2 warnings generated.
> 
> 
> vim +379 fs/nfs/flexfilelayout/flexfilelayoutdev.c
> 
> cefa587a40bb53 Trond Myklebust       2019-02-28  350
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  351  /**
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  352   *
> nfs4_ff_layout_prepare_ds - prepare a DS connection for an RPC call
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  353   * @lseg: the layout
> segment we're operating on
> 2444ff277a686d Trond Myklebust       2019-02-14  354   * @mirror: layout mirror
> describing the DS to use
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  355   * @fail_return: return
> layout on connect failure?
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  356   *
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  357   * Try to prepare a DS
> connection to accept an RPC call. This involves
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  358   * selecting a mirror to
> use and connecting the client to it if it's not
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  359   * already connected.
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  360   *
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  361   * Since we only need a
> single functioning mirror to satisfy a read, we don't
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  362   * want to return the
> layout if there is one. For writes though, any down
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  363   * mirror should result in
> a LAYOUTRETURN. @fail_return is how we distinguish
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  364   * between the two cases.
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  365   *
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  366   * Returns a pointer to a
> connected DS object on success or NULL on failure.
> 95e2b7e95d43c5 Jeff Layton           2016-05-17  367   */
> d67ae825a59d63 Tom Haynes            2014-12-11  368  struct nfs4_pnfs_ds *
> 2444ff277a686d Trond Myklebust       2019-02-14  369
> nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
> 2444ff277a686d Trond Myklebust       2019-02-14  370  			  struct
> nfs4_ff_layout_mirror *mirror,
> d67ae825a59d63 Tom Haynes            2014-12-11  371  			  bool fail_return)
> d67ae825a59d63 Tom Haynes            2014-12-11  372  {
> 6468b866bac7de root max-exfl020      2025-06-26  373  	struct nfs4_pnfs_ds *ds =
> ERR_PTR(-EAGAIN);
> d67ae825a59d63 Tom Haynes            2014-12-11  374  	struct inode *ino =
> lseg->pls_layout->plh_inode;
> d67ae825a59d63 Tom Haynes            2014-12-11  375  	struct nfs_server *s =
> NFS_SERVER(ino);
> d67ae825a59d63 Tom Haynes            2014-12-11  376  	unsigned int max_payload;
> a33e4b036d4612 Weston Andros Adamson 2017-03-09  377  	int status;
> d67ae825a59d63 Tom Haynes            2014-12-11  378
> cefa587a40bb53 Trond Myklebust       2019-02-28 @379  	if
> (!ff_layout_init_mirror_ds(lseg->pls_layout, mirror))
> 0a156dd58274b0 Trond Myklebust       2019-02-27  380  		goto noconnect;
> d67ae825a59d63 Tom Haynes            2014-12-11  381
> d67ae825a59d63 Tom Haynes            2014-12-11  382  	ds =
> mirror->mirror_ds->ds;
> a2915fa06227b0 Baptiste Lepers       2021-09-06  383  	if
> (READ_ONCE(ds->ds_clp))
> a2915fa06227b0 Baptiste Lepers       2021-09-06  384  		goto out;
> d67ae825a59d63 Tom Haynes            2014-12-11  385  	/* matching smp_wmb() in
> _nfs4_pnfs_v3/4_ds_connect */
> d67ae825a59d63 Tom Haynes            2014-12-11  386  	smp_rmb();
> d67ae825a59d63 Tom Haynes            2014-12-11  387
> d67ae825a59d63 Tom Haynes            2014-12-11  388  	/* FIXME: For now we
> assume the server sent only one version of NFS
> d67ae825a59d63 Tom Haynes            2014-12-11  389  	 * to use for the DS.
> d67ae825a59d63 Tom Haynes            2014-12-11  390  	 */
> 2444ff277a686d Trond Myklebust       2019-02-14  391  	status =
> nfs4_pnfs_ds_connect(s, ds, &mirror->mirror_ds->id_node,
> 2444ff277a686d Trond Myklebust       2019-02-14  392  			     dataserver_timeo,
> dataserver_retrans,
> d67ae825a59d63 Tom Haynes            2014-12-11  393
> 			     mirror->mirror_ds->ds_versions[0].version,
> 7d38de3ffa75f9 Anna Schumaker        2016-11-17  394
> 			     mirror->mirror_ds->ds_versions[0].minor_version);
> d67ae825a59d63 Tom Haynes            2014-12-11  395
> d67ae825a59d63 Tom Haynes            2014-12-11  396  	/* connect success, check
> rsize/wsize limit */
> 260f32adb88dad Trond Myklebust       2017-04-20  397  	if (!status) {
> d488b9d01fbc2f Trond Myklebust       2024-09-05  398  		/*
> d488b9d01fbc2f Trond Myklebust       2024-09-05  399  		 * ds_clp is put in
> destroy_ds().
> d488b9d01fbc2f Trond Myklebust       2024-09-05  400  		 * keep ds_clp even if
> DS is local, so that if local IO cannot
> d488b9d01fbc2f Trond Myklebust       2024-09-05  401  		 * proceed somehow, we
> can fall back to NFS whenever we want.
> d488b9d01fbc2f Trond Myklebust       2024-09-05  402  		 */
> 1ff4716f420b5a Mike Snitzer          2025-05-13  403
> 		nfs_local_probe_async(ds->ds_clp);
> d67ae825a59d63 Tom Haynes            2014-12-11  404  		max_payload =
> d67ae825a59d63 Tom Haynes            2014-12-11  405
> 			nfs_block_size(rpc_max_payload(ds->ds_clp->cl_rpcclient),
> d67ae825a59d63 Tom Haynes            2014-12-11  406  				       NULL);
> d67ae825a59d63 Tom Haynes            2014-12-11  407  		if
> (mirror->mirror_ds->ds_versions[0].rsize > max_payload)
> d67ae825a59d63 Tom Haynes            2014-12-11  408
> 			mirror->mirror_ds->ds_versions[0].rsize = max_payload;
> d67ae825a59d63 Tom Haynes            2014-12-11  409  		if
> (mirror->mirror_ds->ds_versions[0].wsize > max_payload)
> d67ae825a59d63 Tom Haynes            2014-12-11  410
> 			mirror->mirror_ds->ds_versions[0].wsize = max_payload;
> 3dc147359e3dcd Trond Myklebust       2016-08-29  411  		goto out;
> 3dc147359e3dcd Trond Myklebust       2016-08-29  412  	}
> 0a156dd58274b0 Trond Myklebust       2019-02-27  413  noconnect:
> d67ae825a59d63 Tom Haynes            2014-12-11  414
> 	ff_layout_track_ds_error(FF_LAYOUT_FROM_HDR(lseg->pls_layout),
> d67ae825a59d63 Tom Haynes            2014-12-11  415  				 mirror,
> lseg->pls_range.offset,
> d67ae825a59d63 Tom Haynes            2014-12-11  416
> 				 lseg->pls_range.length, NFS4ERR_NXIO,
> d67ae825a59d63 Tom Haynes            2014-12-11  417  				 OP_ILLEGAL,
> GFP_NOIO);
> f0922a6c0cdb92 Trond Myklebust       2019-02-10  418
> 	ff_layout_send_layouterror(lseg);
> 094069f1d96f69 Jeff Layton           2016-05-17  419  	if (fail_return ||
> !ff_layout_has_available_ds(lseg))
> d67ae825a59d63 Tom Haynes            2014-12-11  420
> 		pnfs_error_mark_layout_for_return(ino, lseg);
> 6468b866bac7de root max-exfl020      2025-06-26  421  	ds = ERR_PTR(status);
> d67ae825a59d63 Tom Haynes            2014-12-11  422  out:
> d67ae825a59d63 Tom Haynes            2014-12-11  423  	return ds;
> d67ae825a59d63 Tom Haynes            2014-12-11  424  }
> d67ae825a59d63 Tom Haynes            2014-12-11  425
> 
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 2826 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-27  6:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-26  9:12 [PATCH] pNFS/flexfiles: don't attempt pnfs on fatal DS errors Tigran Mkrtchyan
2025-06-26 23:42 ` kernel test robot
2025-06-27  6:37   ` Mkrtchyan, Tigran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox