public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfsd/vfs.c: endianness fixes
@ 2005-12-25  6:29 Al Viro
  2005-12-25  6:44 ` [PATCH] nfsd4_truncate() bogus return value Al Viro
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Al Viro @ 2005-12-25  6:29 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, Neil Brown

From: Al Viro <viro@zeniv.linux.org.uk>
Date: 1135476096 -0500

several failure exits return -E<something> instead of nfserr_<something>
and vice versa.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

---

 fs/nfsd/vfs.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

38c78c8cfcd1be715fb280f83e2b1ce2f709abc8
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index af7c3c3..f237f98 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1134,7 +1134,7 @@ nfsd_create(struct svc_rqst *rqstp, stru
 				"nfsd_create: parent %s/%s not locked!\n",
 				dentry->d_parent->d_name.name,
 				dentry->d_name.name);
-			err = -EIO;
+			err = nfserr_io;
 			goto out;
 		}
 	}
@@ -1592,7 +1592,7 @@ nfsd_rename(struct svc_rqst *rqstp, stru
 	if ((ffhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
 		((atomic_read(&odentry->d_count) > 1)
 		 || (atomic_read(&ndentry->d_count) > 1))) {
-			err = nfserr_perm;
+			err = -EPERM;
 	} else
 #endif
 	err = vfs_rename(fdir, odentry, tdir, ndentry);
@@ -1663,7 +1663,7 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
 #ifdef MSNFS
 		if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
 			(atomic_read(&rdentry->d_count) > 1)) {
-			err = nfserr_perm;
+			err = -EPERM;
 		} else
 #endif
 		err = vfs_unlink(dirp, rdentry);
-- 
0.99.9.GIT


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

* [PATCH] nfsd4_truncate() bogus return value
  2005-12-25  6:29 [PATCH] nfsd/vfs.c: endianness fixes Al Viro
@ 2005-12-25  6:44 ` Al Viro
  2005-12-25  6:48 ` [PATCH] NFSERR_SERVERFAULT returned host-endian Al Viro
  2005-12-25  6:49 ` [PATCH] nfsd4_lock() returns bogus values to clients Al Viro
  2 siblings, 0 replies; 5+ messages in thread
From: Al Viro @ 2005-12-25  6:44 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, Neil Brown

From: Al Viro <viro@zeniv.linux.org.uk>
Date: 1135492779 -0500

-EINVAL (in host order, no less) is not a good thing to return to client.
nfsd4_truncate() returns it in one case and its callers expect nfs_....
from it.  AFAICS, it should be nfserr_inval

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

---

 fs/nfsd/nfs4state.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

af894f171cc6fb5612ff74a3d32c62492c7a5a98
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 6bbefd0..7fec0ac 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1648,7 +1648,7 @@ nfsd4_truncate(struct svc_rqst *rqstp, s
 	if (!open->op_truncate)
 		return 0;
 	if (!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
-		return -EINVAL;
+		return nfserr_inval;
 	return nfsd_setattr(rqstp, fh, &iattr, 0, (time_t)0);
 }
 
-- 
0.99.9.GIT


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

* [PATCH] NFSERR_SERVERFAULT returned host-endian
  2005-12-25  6:29 [PATCH] nfsd/vfs.c: endianness fixes Al Viro
  2005-12-25  6:44 ` [PATCH] nfsd4_truncate() bogus return value Al Viro
@ 2005-12-25  6:48 ` Al Viro
  2005-12-25  6:49 ` [PATCH] nfsd4_lock() returns bogus values to clients Al Viro
  2 siblings, 0 replies; 5+ messages in thread
From: Al Viro @ 2005-12-25  6:48 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, Neil Brown

From: Al Viro <viro@zeniv.linux.org.uk>
Date: 1135492936 -0500

->rp_status is network-endian and nobody byteswaps it before sending to
client; putting NFSERR_SERVERFAULT instead of nfserr_serverfault in there
is not nice...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

---

 fs/nfsd/nfs4state.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

8b3750ba77fdb6939689cbeff336d6153531fe96
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 7fec0ac..71689b0 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1088,7 +1088,7 @@ alloc_init_open_stateowner(unsigned int 
 	sop->so_seqid = open->op_seqid;
 	sop->so_confirmed = 0;
 	rp = &sop->so_replay;
-	rp->rp_status = NFSERR_SERVERFAULT;
+	rp->rp_status = nfserr_serverfault;
 	rp->rp_buflen = 0;
 	rp->rp_buf = rp->rp_ibuf;
 	return sop;
@@ -2633,7 +2633,7 @@ alloc_init_lock_stateowner(unsigned int 
 	sop->so_seqid = lock->lk_new_lock_seqid + 1;
 	sop->so_confirmed = 1;
 	rp = &sop->so_replay;
-	rp->rp_status = NFSERR_SERVERFAULT;
+	rp->rp_status = nfserr_serverfault;
 	rp->rp_buflen = 0;
 	rp->rp_buf = rp->rp_ibuf;
 	return sop;
-- 
0.99.9.GIT


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

* [PATCH] nfsd4_lock() returns bogus values to clients
  2005-12-25  6:29 [PATCH] nfsd/vfs.c: endianness fixes Al Viro
  2005-12-25  6:44 ` [PATCH] nfsd4_truncate() bogus return value Al Viro
  2005-12-25  6:48 ` [PATCH] NFSERR_SERVERFAULT returned host-endian Al Viro
@ 2005-12-25  6:49 ` Al Viro
  2005-12-25  7:30   ` Al Viro
  2 siblings, 1 reply; 5+ messages in thread
From: Al Viro @ 2005-12-25  6:49 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, Neil Brown

From: Al Viro <viro@zeniv.linux.org.uk>
Date: 1135493243 -0500

missing nfserror() in default case of a switch by return value of
posix_lock_file(); as the result we send negative host-endian to
clients that expect positive network-endian, preferably mentioned
in RFC...  BTW, that case is not impossible - posix_lock_file()
can return -ENOLCK and we do not handle that one explicitly.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

---

 fs/nfsd/nfs4state.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

d91fdfa7ab75e45dd9dba36808d36fc2e1d5c634
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 71689b0..f32f68c 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2815,7 +2815,10 @@ nfsd4_lock(struct svc_rqst *rqstp, struc
 		goto conflicting_lock;
 	case (EDEADLK):
 		status = nfserr_deadlock;
+		dprintk("NFSD: nfsd4_lock: posix_lock_file() failed! status %d\n",status);
+		goto out_destroy_new_stateid;
 	default:        
+		status = nfserror(status);
 		dprintk("NFSD: nfsd4_lock: posix_lock_file() failed! status %d\n",status);
 		goto out_destroy_new_stateid;
 	}
-- 
0.99.9.GIT


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

* Re: [PATCH] nfsd4_lock() returns bogus values to clients
  2005-12-25  6:49 ` [PATCH] nfsd4_lock() returns bogus values to clients Al Viro
@ 2005-12-25  7:30   ` Al Viro
  0 siblings, 0 replies; 5+ messages in thread
From: Al Viro @ 2005-12-25  7:30 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, Neil Brown

On Sun, Dec 25, 2005 at 06:49:33AM +0000, Al Viro wrote:
> From: Al Viro <viro@zeniv.linux.org.uk>
> Date: 1135493243 -0500
> 
> missing nfserror() in default case of a switch by return value of
> posix_lock_file(); as the result we send negative host-endian to
> clients that expect positive network-endian, preferably mentioned
> in RFC...  BTW, that case is not impossible - posix_lock_file()
> can return -ENOLCK and we do not handle that one explicitly.

Gaack...  s/nfserror/nfserrno/, of course...

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

end of thread, other threads:[~2005-12-25  7:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-25  6:29 [PATCH] nfsd/vfs.c: endianness fixes Al Viro
2005-12-25  6:44 ` [PATCH] nfsd4_truncate() bogus return value Al Viro
2005-12-25  6:48 ` [PATCH] NFSERR_SERVERFAULT returned host-endian Al Viro
2005-12-25  6:49 ` [PATCH] nfsd4_lock() returns bogus values to clients Al Viro
2005-12-25  7:30   ` Al Viro

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