Skip to contentSkip to conversation

pnfs DLM cluster only use read iomode layouts

PATCH In review [email protected] 4 participants 13 messages Feb 5, 2010 – Feb 9, 2010

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

cover pnfs DLM cluster only use read iomode layouts

Applies against 2.6.33-rc6 pnfs-all branch.

In a DLM cluster, writing to a node other than the node where the open call occurred and where meta data is cached will have performance implications when the write causes meta data changes that need to be propagated to the open call node.

Return NFS4ERR_BADIOMODE for LAYOUTGET requests with LAYOUTIOMODE4_RW iomode.

Plus a couple of error code fixes.

0001-pnfsd-fix-NFS4ERR_BADIOMODE-in-layoutget.patch 0002-pnfsd-fix-pnfs_export_operations-layoutget-valid-err.patch 0003-pnfsd-DLM-file-layout-only-support-read-iomode-layou.patch 0004-pnfsd-fix-DLM-file-layout-no-device-return.patch

Allow the client to fail a RW iomode layout and still grab a RO iomode layout. 0005-pnfs-set-failed-layout-bit-per-iomode.patch

Testing: Connectathon tests pass. Basic test shows RW iomode layout for 'bigfile' fails with NFS4ERR_BADIOMODE with writes going through the MDS, and RO layout for 'bigfile' is obtained with reads going to the DS.

-->Andy

#1 lore raw

PATCH 1/5 pnfsd: fix NFS4ERR_BADIOMODE in layoutget

From: Andy Adamson <[email protected]>

If an invalid iomode, or an iomode of LAYOUTIOMODE4_ANY is specified, the metadata server MUST return NFS4ERR_BADIOMODE.

---
 fs/nfsd/nfs4proc.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)
fs/nfsd/nfs4proc.c +2 -9
index 769628f..575e1b6 100644
@@ -1114,21 +1114,14 @@ nfsd4_layoutget(struct svc_rqst *rqstp,
 	if (status)
 		goto out;
 
-	status = nfserr_inval;
+	status = nfserr_badiomode;
 	if (lgp->lg_seg.iomode != IOMODE_READ &&
-	    lgp->lg_seg.iomode != IOMODE_RW &&
-	    lgp->lg_seg.iomode != IOMODE_ANY) {
+	    lgp->lg_seg.iomode != IOMODE_RW) {
 		dprintk("pNFS %s: invalid iomode %d\n", __func__,
 			lgp->lg_seg.iomode);
 		goto out;
 	}
 
-	status = nfserr_badiomode;
-	if (lgp->lg_seg.iomode == IOMODE_ANY) {
-		dprintk("pNFS %s: IOMODE_ANY is not allowed\n", __func__);
-		goto out;
-	}
-
 	/* Set up arguments so layout can be retrieved at encode time */
 	lgp->lg_fhp = current_fh;
 	copy_clientid((clientid_t *)&lgp->lg_seg.clientid, cstate->session);
Signature · 1 line
1.6.6
#2 lore raw

PATCH 2/5 pnfsd: fix pnfs_export_operations layoutget valid errors

From: Andy Adamson <[email protected]>

---
 fs/nfsd/nfs4pnfsd.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
fs/nfsd/nfs4pnfsd.c +2 -4
index 816e2f0..3951e02 100644
@@ -870,6 +870,7 @@ nfs4_pnfs_get_layout(struct nfsd4_pnfs_layoutget *lgp,
 	if (status) {
 		switch (status) {
 		case -ETOOSMALL:
+		case -E2BIG:
 			status = nfserr_toosmall;
 			break;
 		case -ENOMEM:
@@ -878,10 +879,7 @@ nfs4_pnfs_get_layout(struct nfsd4_pnfs_layoutget *lgp,
 			status = nfserr_layouttrylater;
 			break;
 		case -ENOENT:
-			status = nfserr_badlayout;
-			break;
-		case -E2BIG:
-			status = nfserr_toosmall;
+			status = nfserr_stale;
 			break;
 		default:
 			status = nfserr_layoutunavailable;
Signature · 1 line
1.6.6
#3 lore raw

PATCH 3/5 pnfsd: DLM file layout only support read iomode layouts

From: Andy Adamson <[email protected]>

In a DLM cluster, writing to a node other than the node where the open call occurred and where meta data is cached will have performance implications when the write causes meta data changes that need to be propagated to the open call node.

DlM clusters support only LAYOUTIOMODE4_READ layouts. Writes will go through the MDS.

Return NFS4ERR_BADIOMODE for LAYOUTGET requests with LAYOUTIOMODE4_RW iomode.

---
 fs/nfsd/nfs4pnfsd.c   |    2 ++
 fs/nfsd/nfs4pnfsdlm.c |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)
fs/nfsd/nfs4pnfsd.c +2 -0
index 3951e02..e1ecf81 100644
@@ -881,6 +881,8 @@ nfs4_pnfs_get_layout(struct nfsd4_pnfs_layoutget *lgp,
 		case -ENOENT:
 			status = nfserr_stale;
 			break;
+		case nfserr_badiomode:
+			break;
 		default:
 			status = nfserr_layoutunavailable;
 		}
fs/nfsd/nfs4pnfsdlm.c +5 -0
index 293bf95..8cc7c84 100644
@@ -28,6 +28,7 @@
 #include <linux/nfsd/nfs4layoutxdr.h>
 
 #include "nfsfh.h"
+#include "nfsd.h"
 
 #define NFSDDBG_FACILITY                NFSDDBG_PROC
 
@@ -331,6 +332,10 @@ static int nfsd4_pnfs_dlm_layoutget(struct inode *inode,
 
 	dprintk("%s: LAYOUT_GET\n", __func__);
 
+	/* DLM exported file systems only support layouts for READ */
+	if (res->lg_seg.iomode == IOMODE_RW)
+		return nfserr_badiomode;
+
 	index = dlm_ino_hash(inode);
 	dprintk("%s first stripe index %d i_ino %lu\n", __func__, index,
 		inode->i_ino);
Signature · 1 line
1.6.6
#4 lore raw

PATCH 4/5 pnfsd: fix DLM file layout no device return

From: Andy Adamson <[email protected]>

---
 fs/nfsd/nfs4pnfsdlm.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4pnfsdlm.c +2 -2
index 8cc7c84..83c4698 100644
@@ -316,7 +316,7 @@ static int dlm_ino_hash(struct inode *ino)
 	 */
 	de = nfsd4_find_pnfs_dlm_device(ino->i_sb->s_bdev->bd_disk->disk_name);
 	if (!de)
-		return -EINVAL;
+		return -1;
 	hash_mask = de->num_ds - 1;
 	return ino->i_ino & hash_mask;
 }
@@ -340,7 +340,7 @@ static int nfsd4_pnfs_dlm_layoutget(struct inode *inode,
 	dprintk("%s first stripe index %d i_ino %lu\n", __func__, index,
 		inode->i_ino);
 	if (index < 0)
-		return index;
+		return nfserr_layoutunavailable;
 
 	res->lg_seg.layout_type = LAYOUT_NFSV4_FILES;
 	/* Always give out whole file layouts */
Signature · 1 line
1.6.6
#5 lore raw

PATCH 5/5 pnfs: set failed layout bit per iomode

From: Andy Adamson <[email protected]>

---
 fs/nfs/pnfs.c          |    6 +++---
 fs/nfs/pnfs.h          |    6 ++++++
 include/linux/nfs_fs.h |    5 +++--
 3 files changed, 12 insertions(+), 5 deletions(-)
fs/nfs/pnfs.c +3 -3
index 3a05422..596cfce 100644
@@ -1119,11 +1119,11 @@ pnfs_update_layout(struct inode *ino,
 	}
 
 	/* if get layout already failed once goto out */
-	if (test_bit(NFS_INO_LAYOUT_FAILED, &nfsi->pnfs_layout_state)) {
+	if (test_bit(lo_fail_bit(iomode), &nfsi->pnfs_layout_state)) {
 		if (unlikely(nfsi->pnfs_layout_suspend &&
 		    get_seconds() >= nfsi->pnfs_layout_suspend)) {
 			dprintk("%s: layout_get resumed\n", __func__);
-			clear_bit(NFS_INO_LAYOUT_FAILED,
+			clear_bit(lo_fail_bit(iomode),
 				  &nfsi->pnfs_layout_state);
 			nfsi->pnfs_layout_suspend = 0;
 		} else {
@@ -1247,7 +1247,7 @@ pnfs_get_layout_done(struct nfs4_pnfs_layoutget *lgp, int rpc_status)
 get_out:
 	/* remember that get layout failed and suspend trying */
 	nfsi->pnfs_layout_suspend = suspend;
-	set_bit(NFS_INO_LAYOUT_FAILED, &nfsi->pnfs_layout_state);
+	set_bit(lo_fail_bit(lgp->args.lseg.iomode), &nfsi->pnfs_layout_state);
 	dprintk("%s: layout_get suspended until %ld\n",
 		__func__, suspend);
 out:
fs/nfs/pnfs.h +6 -0
index 379e67d..312c4ef 100644
@@ -94,6 +94,12 @@ void pnfs_set_layout_stateid(struct pnfs_layout_type *lo,
 				     (srv)->pnfs_curr_ld->ld_policy_ops && \
 				     (srv)->pnfs_curr_ld->ld_policy_ops->opname)
 
+static inline int lo_fail_bit(u32 iomode)
+{
+	return iomode == IOMODE_RW ?
+			 NFS_INO_RW_LAYOUT_FAILED : NFS_INO_RO_LAYOUT_FAILED;
+}
+
 /* Return true if a layout driver is being used for this mountpoint */
 static inline int pnfs_enabled_sb(struct nfs_server *nfss)
 {
include/linux/nfs_fs.h +3 -2
index fc0990a..dd57a6a 100644
@@ -201,8 +201,9 @@ struct nfs_inode {
 	struct list_head	lo_inodes;
 
 	unsigned long pnfs_layout_state;
-#define NFS_INO_LAYOUT_FAILED	0	/* get layout failed, stop trying */
-#define NFS_INO_LAYOUT_ALLOC	1	/* bit lock for layout allocation */
+#define NFS_INO_RO_LAYOUT_FAILED 0 	/* get ro layout failed stop trying */
+#define NFS_INO_RW_LAYOUT_FAILED 1 	/* get rw layout failed stop trying */
+#define NFS_INO_LAYOUT_ALLOC     2	/* bit lock for layout allocation */
 	time_t pnfs_layout_suspend;
 	wait_queue_head_t lo_waitq;
 	spinlock_t lo_lock;
Signature · 1 line
1.6.6
#6 lore raw

Re: [pnfs] [PATCH 4/5] pnfsd: fix DLM file layout no device return

In reply to [email protected]
Quoted 21 lines · On 02/05/2010 07:10 PM, [email protected] wrote:

From: Andy Adamson <[email protected]>

---
 fs/nfsd/nfs4pnfsdlm.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4pnfsdlm.c +1 -1
index 8cc7c84..83c4698 100644
@@ -316,7 +316,7 @@ static int dlm_ino_hash(struct inode *ino)
 	 */
 	de = nfsd4_find_pnfs_dlm_device(ino->i_sb->s_bdev->bd_disk->disk_name);
 	if (!de)
-		return -EINVAL;
+		return -1;
 	hash_mask = de->num_ds - 1;
 	return ino->i_ino & hash_mask;
 }

fs/nfsd/nfs4pnfsdlm.c static int nfsd4_pnfs_dlm_layoutget(struct inode *inode, · line 343

Quoted 5 lines
fs/nfsd/nfs4pnfsdlm.c +1 -1
@@ -340,7 +340,7 @@ static int nfsd4_pnfs_dlm_layoutget(struct inode *inode,
 	dprintk("%s first stripe index %d i_ino %lu\n", __func__, index,
 		inode->i_ino);
 	if (index < 0)
-		return index;
+		return nfserr_layoutunavailable;

You are relaying on a side effect that undefined errors are nfserr_layoutunavailable. That's not so noble ;)

I wish we would only allow nfserr_* and your first patch defines the allowed returns from layoutget

(I can fix exofs, easily, if we just agree on protocol)

Thanks
Boaz

Quoted 3 lines
fs/nfsd/nfs4pnfsdlm.c +0 -0
 	res->lg_seg.layout_type = LAYOUT_NFSV4_FILES;
 	/* Always give out whole file layouts */
#7 lore raw

Re: [pnfs] [PATCH 3/5] pnfsd: DLM file layout only support read iomode layouts

In reply to [email protected]
Quoted 23 lines · On 02/05/2010 07:10 PM, [email protected] wrote:

From: Andy Adamson <[email protected]>

In a DLM cluster, writing to a node other than the node where the open call occurred and where meta data is cached will have performance implications when the write causes meta data changes that need to be propagated to the open call node.

DlM clusters support only LAYOUTIOMODE4_READ layouts. Writes will go through the MDS.

Return NFS4ERR_BADIOMODE for LAYOUTGET requests with LAYOUTIOMODE4_RW iomode.

---
 fs/nfsd/nfs4pnfsd.c   |    2 ++
 fs/nfsd/nfs4pnfsdlm.c |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)
fs/nfsd/nfs4pnfsd.c +0 -0
index 3951e02..e1ecf81 100644

fs/nfsd/nfs4pnfsd.c nfs4_pnfs_get_layout(struct nfsd4_pnfs_layoutget *lgp, · line 885

Quoted 5 lines
fs/nfsd/nfs4pnfsd.c +2 -0
@@ -881,6 +881,8 @@ nfs4_pnfs_get_layout(struct nfsd4_pnfs_layoutget *lgp,
 		case -ENOENT:
 			status = nfserr_stale;
 			break;
+		case nfserr_badiomode:
+			break;

2 questions:

- Why In this patch? - The first patch already fixes up what is allowed and what is not. It is more clear to establish protocol in one place so we can review.

- Why only this one? Why not all the nfserr_xxx allowed/make-sense, in a layoutget operation?

In my opinion we should only allow nfserr_xxx constants and be done with it It should not be hard to fix all users.

Boaz

Quoted 26 lines
fs/nfsd/nfs4pnfsd.c +0 -0
 		default:
 			status = nfserr_layoutunavailable;
 		}
fs/nfsd/nfs4pnfsdlm.c +5 -0
index 293bf95..8cc7c84 100644
@@ -28,6 +28,7 @@
 #include <linux/nfsd/nfs4layoutxdr.h>
 
 #include "nfsfh.h"
+#include "nfsd.h"
 
 #define NFSDDBG_FACILITY                NFSDDBG_PROC
 
@@ -331,6 +332,10 @@ static int nfsd4_pnfs_dlm_layoutget(struct inode *inode,
 
 	dprintk("%s: LAYOUT_GET\n", __func__);
 
+	/* DLM exported file systems only support layouts for READ */
+	if (res->lg_seg.iomode == IOMODE_RW)
+		return nfserr_badiomode;
+
 	index = dlm_ino_hash(inode);
 	dprintk("%s first stripe index %d i_ino %lu\n", __func__, index,
 		inode->i_ino);
#8 lore raw

Re: [pnfs] [PATCH 2/5] pnfsd: fix pnfs_export_operations layoutget valid errors

In reply to [email protected]
Quoted 12 lines · On Feb. 05, 2010, 19:10 +0200, [email protected] wrote:

From: Andy Adamson <[email protected]>

---
 fs/nfsd/nfs4pnfsd.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
fs/nfsd/nfs4pnfsd.c +0 -0
index 816e2f0..3951e02 100644

fs/nfsd/nfs4pnfsd.c nfs4_pnfs_get_layout(struct nfsd4_pnfs_layoutget *lgp, · line 873

Quoted 4 lines
fs/nfsd/nfs4pnfsd.c +1 -0
@@ -870,6 +870,7 @@ nfs4_pnfs_get_layout(struct nfsd4_pnfs_layoutget *lgp,
 	if (status) {
 		switch (status) {
 		case -ETOOSMALL:
+		case -E2BIG:

Should we allow the filesystem to return nfs errors? Or even require it to do so?

This can be done by adding cases for the
valid error values for LAYOUTGET in this switch statement.

Benny

fs/nfsd/nfs4pnfsd.c nfs4_pnfs_get_layout(struct nfsd4_pnfs_layoutget *lgp,

Quoted 4 lines
fs/nfsd/nfs4pnfsd.c +0 -0
 			status = nfserr_toosmall;
 			break;
 		case -ENOMEM:
@@ -878,10 +879,7 @@ nfs4_pnfs_get_layout(struct nfsd4_pnfs_layoutget *lgp,

case nfserr_layouttrylater:

Quoted 11 lines
fs/nfsd/nfs4pnfsd.c +1 -4
 			status = nfserr_layouttrylater;
 			break;
 		case -ENOENT:
-			status = nfserr_badlayout;
-			break;
-		case -E2BIG:
-			status = nfserr_toosmall;
+			status = nfserr_stale;
 			break;
 		default:
 			status = nfserr_layoutunavailable;
#9 lore raw

Re: [pnfs] [PATCH 2/5] pnfsd: fix pnfs_export_operations layoutget valid errors

Quoted 22 lines · Benny Halevy
Quoted 12 lines · On Feb. 05, 2010, 19:10 +0200, [email protected] wrote:

From: Andy Adamson <[email protected]>

---
fs/nfsd/nfs4pnfsd.c | 6 ++----

1 files changed, 2 insertions(+), 4 deletions(-)
fs/nfsd/nfs4pnfsd.c +0 -0
index 816e2f0..3951e02 100644

fs/nfsd/nfs4pnfsd.c nfs4_pnfs_get_layout(struct · line 874

Quoted 5 lines
fs/nfsd/nfs4pnfsd.c +1 -0
@@ -870,6 +870,7 @@ nfs4_pnfs_get_layout(struct  
 nfsd4_pnfs_layoutget *lgp,
 	if (status) {
 		switch (status) {
 		case -ETOOSMALL:
+		case -E2BIG:

Should we allow the filesystem to return nfs errors? Or even require it to do so?

Quoted 2 lines

This can be done by adding cases for the
valid error values for LAYOUTGET in this switch statement.

OK. From re-reading all the past mail and the comments on this latest patch set:

1) We want a limited number of well documented error returns - documented as part of the filesystem API not just the spec.

2) Start with just the errors that we know we need for gfs2 and exofs, and expand the list later as necessary.

3) Allow only nfserr_xxxx errors.

Does this address the comments? Do you want more documentation, if so, where?

        if (status) {
+               /*
+                * The allowable error codes for the layout_get pNFS export
+                * operations vector function can be expanded as needed
+                * to include other errors defined for the LAYOUTGET pNFS
+                * operation.
+                */
+               case nfserr_badiomode:
+               case nfserr_badlayout:
+               case nfserr_layouttrylater:
+               case nfserr_layoutunavailable:
+               case nfserr_toosmall:
                        break;
                default:
+                       BUG();
                }
                goto out_freelayout;

-->Andy

Quoted 26 lines

Benny

fs/nfsd/nfs4pnfsd.c nfs4_pnfs_get_layout(struct · line 879

Quoted 5 lines
fs/nfsd/nfs4pnfsd.c +0 -0
 			status = nfserr_toosmall;
 			break;

case -ENOMEM:

fs/nfsd/nfs4pnfsd.c +0 -0
@@ -878,10 +879,7 @@ nfs4_pnfs_get_layout(struct  
 nfsd4_pnfs_layoutget *lgp,

case nfserr_layouttrylater:

Quoted 11 lines
fs/nfsd/nfs4pnfsd.c +1 -4
 			status = nfserr_layouttrylater;
 			break;
 		case -ENOENT:
-			status = nfserr_badlayout;
-			break;
-		case -E2BIG:
-			status = nfserr_toosmall;
+			status = nfserr_stale;
 			break;
 		default:
			status = nfserr_layoutunavailable;

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw

Re: [pnfs] [PATCH 2/5] pnfsd: fix pnfs_export_operations layoutget valid errors

Quoted 50 lines · Andy Adamson
Quoted 22 lines · Benny Halevy
Quoted 12 lines · On Feb. 05, 2010, 19:10 +0200, [email protected] wrote:

From: Andy Adamson <[email protected]>

---
fs/nfsd/nfs4pnfsd.c | 6 ++----

1 files changed, 2 insertions(+), 4 deletions(-)
fs/nfsd/nfs4pnfsd.c +0 -0
index 816e2f0..3951e02 100644

fs/nfsd/nfs4pnfsd.c nfs4_pnfs_get_layout(struct nfsd4_pnfs_layoutget · line 874

Quoted 5 lines
fs/nfsd/nfs4pnfsd.c +1 -0
@@ -870,6 +870,7 @@ nfs4_pnfs_get_layout(struct nfsd4_pnfs_layoutget 
 *lgp,
 	if (status) {
 		switch (status) {
 		case -ETOOSMALL:
+		case -E2BIG:

Should we allow the filesystem to return nfs errors? Or even require it to do so?

Quoted 2 lines

This can be done by adding cases for the
valid error values for LAYOUTGET in this switch statement.

OK. From re-reading all the past mail and the comments on this latest patch set:

1) We want a limited number of well documented error returns - documented as part of the filesystem API not just the spec.

2) Start with just the errors that we know we need for gfs2 and exofs, and expand the list later as necessary.

3) Allow only nfserr_xxxx errors.

Does this address the comments? Do you want more documentation, if so, where?

        if (status) {
(quoted diff) +2 -0
+               /*
+                * The allowable error codes for the layout_get pNFS  

export

(quoted diff) +2 -0
+                * operations vector function can be expanded as needed
+                * to include other errors defined for the LAYOUTGET  

pNFS

Review

Quoted 2 lines
(quoted diff) +2 -0
+                * operation.
+                */

Could you dump some description of the cases into the error numbers, if it's not obvious? E.g.:

Quoted 1 line

+ case nfserr_badiomode:

			/*
			 * filesystem doesn't want to give out a
			 * writeable layout in this case.
			 */

Review

Quoted 4 lines
(quoted diff) +4 -0
+               case nfserr_badlayout:
+               case nfserr_layouttrylater:
+               case nfserr_layoutunavailable:
+               case nfserr_toosmall:

just to summarize what the various filesystems are doing.

And don't worry about it being a little messy or verbose; we can clean it up later.

--b.

#11 lore raw

Re: [pnfs] [PATCH 2/5] pnfsd: fix pnfs_export_operations layoutget valid errors

In reply to Andy Adamson
Quoted 55 lines · Andy Adamson
Quoted 22 lines · Benny Halevy
Quoted 12 lines · On Feb. 05, 2010, 19:10 +0200, [email protected] wrote:

From: Andy Adamson <[email protected]>

---
fs/nfsd/nfs4pnfsd.c | 6 ++----

1 files changed, 2 insertions(+), 4 deletions(-)
fs/nfsd/nfs4pnfsd.c +0 -0
index 816e2f0..3951e02 100644

fs/nfsd/nfs4pnfsd.c nfs4_pnfs_get_layout(struct · line 874

Quoted 5 lines
fs/nfsd/nfs4pnfsd.c +1 -0
@@ -870,6 +870,7 @@ nfs4_pnfs_get_layout(struct  
 nfsd4_pnfs_layoutget *lgp,
 	if (status) {
 		switch (status) {
 		case -ETOOSMALL:
+		case -E2BIG:

Should we allow the filesystem to return nfs errors? Or even require it to do so?

Quoted 2 lines

This can be done by adding cases for the
valid error values for LAYOUTGET in this switch statement.

OK. From re-reading all the past mail and the comments on this latest patch set:

1) We want a limited number of well documented error returns - documented as part of the filesystem API not just the spec.

2) Start with just the errors that we know we need for gfs2 and exofs, and expand the list later as necessary.

3) Allow only nfserr_xxxx errors.

Does this address the comments? Do you want more documentation, if so, where?

         if (status) {
(quoted diff) +2 -0
+               /*
+                * The allowable error codes for the layout_get pNFS  

export

(quoted diff) +2 -0
+                * operations vector function can be expanded as needed
+                * to include other errors defined for the LAYOUTGET  

pNFS

(quoted diff) +4 -0
+                * operation.
+                */
+               case nfserr_badiomode:
+               case nfserr_badlayout:

Review

Quoted 10 lines
(quoted diff) +4 -1
+               case nfserr_layouttrylater:
+               case nfserr_layoutunavailable:
+               case nfserr_toosmall:
                         break;
                 default:
+                       BUG();
                 }
                 goto out_freelayout;
 
-->Andy

Perfect. it's all exofs needs.

I've prepared a SQUASHME for pnfsd-exofs to return these. I'll send it as soon as you send the renewed patches.

Thanks Andy
Boaz

Quoted 32 lines
Quoted 11 lines

Benny

fs/nfsd/nfs4pnfsd.c nfs4_pnfs_get_layout(struct · line 879

Quoted 5 lines
fs/nfsd/nfs4pnfsd.c +0 -0
 			status = nfserr_toosmall;
 			break;

case -ENOMEM:

fs/nfsd/nfs4pnfsd.c +0 -0
@@ -878,10 +879,7 @@ nfs4_pnfs_get_layout(struct  
 nfsd4_pnfs_layoutget *lgp,

case nfserr_layouttrylater:

Quoted 16 lines
Quoted 11 lines
fs/nfsd/nfs4pnfsd.c +1 -4
 			status = nfserr_layouttrylater;
 			break;
 		case -ENOENT:
-			status = nfserr_badlayout;
-			break;
-		case -E2BIG:
-			status = nfserr_toosmall;
+			status = nfserr_stale;
 			break;
 		default:
			status = nfserr_layoutunavailable;

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

_______________________________________________
pNFS mailing list
[email protected]
http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs

#12 lore raw

Re: [pnfs] [PATCH 2/5] pnfsd: fix pnfs_export_operations layoutget valid errors

In reply to Andy Adamson
Quoted 48 lines · Andy Adamson
Quoted 21 lines · Benny Halevy
Quoted 12 lines · On Feb. 05, 2010, 19:10 +0200, [email protected] wrote:

From: Andy Adamson <[email protected]>

---
fs/nfsd/nfs4pnfsd.c | 6 ++----

1 files changed, 2 insertions(+), 4 deletions(-)
fs/nfsd/nfs4pnfsd.c +0 -0
index 816e2f0..3951e02 100644

fs/nfsd/nfs4pnfsd.c nfs4_pnfs_get_layout(struct · line 874

Quoted 5 lines
fs/nfsd/nfs4pnfsd.c +1 -0
@@ -870,6 +870,7 @@ nfs4_pnfs_get_layout(struct  
 nfsd4_pnfs_layoutget *lgp,
 	if (status) {
 		switch (status) {
 		case -ETOOSMALL:
+		case -E2BIG:

Should we allow the filesystem to return nfs errors? Or even require it to do so?

Quoted 2 lines

This can be done by adding cases for the
valid error values for LAYOUTGET in this switch statement.

OK. From re-reading all the past mail and the comments on this latest patch set:

1) We want a limited number of well documented error returns - documented as part of the filesystem API not just the spec.

2) Start with just the errors that we know we need for gfs2 and exofs, and expand the list later as necessary.

3) Allow only nfserr_xxxx errors.

Does this address the comments? Do you want more documentation, if so, where?

         if (status) {
(quoted diff) +2 -0
+               /*
+                * The allowable error codes for the layout_get pNFS  

export

(quoted diff) +2 -0
+                * operations vector function can be expanded as needed
+                * to include other errors defined for the LAYOUTGET  

pNFS

Review

Quoted 7 lines
(quoted diff) +7 -0
+                * operation.
+                */
+               case nfserr_badiomode:
+               case nfserr_badlayout:
+               case nfserr_layouttrylater:
+               case nfserr_layoutunavailable:
+               case nfserr_toosmall:

Yup, I think that's the way to go.

Quoted 3 lines
                         break;
                 default:

+ BUG();

There are some generic return values we should allow:
NFS4ERR_ACCESS, NFS4ERR_INVAL, NFS4ERR_IO, NFS4ERR_LOCKED, NFS4ERR_NOSPC, NFS4ERR_RECALLCONFLICT, NFS4ERR_SERVERFAULT

Benny

Quoted 31 lines
                 }
                 goto out_freelayout;

-->Andy

Quoted 25 lines

Benny

fs/nfsd/nfs4pnfsd.c nfs4_pnfs_get_layout(struct · line 879

Quoted 5 lines
fs/nfsd/nfs4pnfsd.c +0 -0
 			status = nfserr_toosmall;
 			break;

case -ENOMEM:

fs/nfsd/nfs4pnfsd.c +0 -0
@@ -878,10 +879,7 @@ nfs4_pnfs_get_layout(struct  
 nfsd4_pnfs_layoutget *lgp,

case nfserr_layouttrylater:

Quoted 11 lines
fs/nfsd/nfs4pnfsd.c +1 -4
 			status = nfserr_layouttrylater;
 			break;
 		case -ENOENT:
-			status = nfserr_badlayout;
-			break;
-		case -E2BIG:
-			status = nfserr_toosmall;
+			status = nfserr_stale;
 			break;
 		default:
			status = nfserr_layoutunavailable;

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html