Skip to contentSkip to conversation

pNFS/filelayout: fix cheking if a layout is striped

PATCH Superseded Sagi Grimberg 1 participant 2 messages Apr 27 – Apr 28

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pNFS/filelayout: fix cheking if a layout is striped

A layout can be striped with num_fh = 1. It is perfectly possible that both MDS and DSs can handle the same filehandle, which is exactly the case in vast pnfs layouts. Hence check according to stripe_count > 1, which is the correct check to begin with.

We should not be called with flseg->dsaddr = NULL, but if for some reason we do, return our best guess with is flseg->num_fh > 1.

Fixes a6b9d2fa0024 ("pNFS/filelayout: Fix coalescing test for single DS")
---
 fs/nfs/filelayout/filelayout.c | 2 ++
 1 file changed, 2 insertions(+)
fs/nfs/filelayout/filelayout.c +2 -0
index 90a11afa5d05..c28b3d5bfa8c 100644
@@ -778,6 +778,8 @@ filelayout_alloc_lseg(struct pnfs_layout_hdr *layoutid,
 static bool
 filelayout_lseg_is_striped(const struct nfs4_filelayout_segment *flseg)
 {
+	if (flseg->dsaddr)
+		return flseg->dsaddr->stripe_count > 1;
 	return flseg->num_fh > 1;
 }
 
Signature · 1 line
2.43.0
#1 lore raw

CC Olga

Quoted 27 lines · Sagi Grimberg

A layout can be striped with num_fh = 1. It is perfectly possible that both MDS and DSs can handle the same filehandle, which is exactly the case in vast pnfs layouts. Hence check according to stripe_count > 1, which is the correct check to begin with.

We should not be called with flseg->dsaddr = NULL, but if for some reason we do, return our best guess with is flseg->num_fh > 1.

Fixes a6b9d2fa0024 ("pNFS/filelayout: Fix coalescing test for single DS")
---
  fs/nfs/filelayout/filelayout.c | 2 ++
  1 file changed, 2 insertions(+)
fs/nfs/filelayout/filelayout.c +2 -0
index 90a11afa5d05..c28b3d5bfa8c 100644
@@ -778,6 +778,8 @@ filelayout_alloc_lseg(struct pnfs_layout_hdr *layoutid,
  static bool
  filelayout_lseg_is_striped(const struct nfs4_filelayout_segment *flseg)
  {
+	if (flseg->dsaddr)
+		return flseg->dsaddr->stripe_count > 1;
  	return flseg->num_fh > 1;
  }