From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: nfs@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [PATCH 014 of 14] knfsd: Don't mess with the 'mode' when storing a exclusive-create cookie.
Date: Wed, 13 Dec 2006 10:59:49 +1100 [thread overview]
Message-ID: <1061212235949.21551@suse.de> (raw)
In-Reply-To: 20061213105528.21128.patches@notabene
From: Peter Staubach <staubach@redhat.com>
NFS V3 (and V4) support exclusive create by passing a 'cookie' which
can get stored with the file. If the file exists but has exactly the
right cookie stored, then we assume this is a retransmit and the
exclusive create was successful.
The cookie is 64bits and is traditionally stored in the mtime and
atime fields. This causes a problem with Solaris7 as negative mtime
or atime confuse it. So we moved two bits into the mode word instead.
But inherited ACLs sometimes overwrite the mode word on create, so
this is a problem.
So we give up and just store 62 of the 64 bits and assume that is
close enough.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./fs/nfsd/vfs.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
diff .prev/fs/nfsd/vfs.c ./fs/nfsd/vfs.c
--- .prev/fs/nfsd/vfs.c 2006-12-08 12:08:37.000000000 +1100
+++ ./fs/nfsd/vfs.c 2006-12-13 10:44:55.000000000 +1100
@@ -1248,7 +1248,6 @@ nfsd_create_v3(struct svc_rqst *rqstp, s
__be32 err;
int host_err;
__u32 v_mtime=0, v_atime=0;
- int v_mode=0;
err = nfserr_perm;
if (!flen)
@@ -1285,16 +1284,11 @@ nfsd_create_v3(struct svc_rqst *rqstp, s
goto out;
if (createmode == NFS3_CREATE_EXCLUSIVE) {
- /* while the verifier would fit in mtime+atime,
- * solaris7 gets confused (bugid 4218508) if these have
- * the high bit set, so we use the mode as well
+ /* solaris7 gets confused (bugid 4218508) if these have
+ * the high bit set, so just clear the high bits.
*/
v_mtime = verifier[0]&0x7fffffff;
v_atime = verifier[1]&0x7fffffff;
- v_mode = S_IFREG
- | ((verifier[0]&0x80000000) >> (32-7)) /* u+x */
- | ((verifier[1]&0x80000000) >> (32-9)) /* u+r */
- ;
}
if (dchild->d_inode) {
@@ -1322,7 +1316,6 @@ nfsd_create_v3(struct svc_rqst *rqstp, s
case NFS3_CREATE_EXCLUSIVE:
if ( dchild->d_inode->i_mtime.tv_sec == v_mtime
&& dchild->d_inode->i_atime.tv_sec == v_atime
- && dchild->d_inode->i_mode == v_mode
&& dchild->d_inode->i_size == 0 )
break;
/* fallthru */
@@ -1344,26 +1337,22 @@ nfsd_create_v3(struct svc_rqst *rqstp, s
}
if (createmode == NFS3_CREATE_EXCLUSIVE) {
- /* Cram the verifier into atime/mtime/mode */
+ /* Cram the verifier into atime/mtime */
iap->ia_valid = ATTR_MTIME|ATTR_ATIME
- | ATTR_MTIME_SET|ATTR_ATIME_SET
- | ATTR_MODE;
+ | ATTR_MTIME_SET|ATTR_ATIME_SET;
/* XXX someone who knows this better please fix it for nsec */
iap->ia_mtime.tv_sec = v_mtime;
iap->ia_atime.tv_sec = v_atime;
iap->ia_mtime.tv_nsec = 0;
iap->ia_atime.tv_nsec = 0;
- iap->ia_mode = v_mode;
}
/* Set file attributes.
- * Mode has already been set but we might need to reset it
- * for CREATE_EXCLUSIVE
* Irix appears to send along the gid when it tries to
* implement setgid directories via NFS. Clear out all that cruft.
*/
set_attr:
- if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID)) != 0) {
+ if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID|ATTR_MODE)) != 0) {
__be32 err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0);
if (err2)
err = err2;
next prev parent reply other threads:[~2006-12-13 0:18 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-12 23:58 [PATCH 000 of 14] knfsd: Assorted nfsd patches for 2.6.20 - prepare for IPv6 and more NeilBrown
2006-12-12 23:58 ` [PATCH 001 of 14] knfsd: SUNRPC: update internal API: separate pmap register and temp sockets NeilBrown
2006-12-12 23:58 ` [PATCH 002 of 14] knfsd: SUNRPC: allow creating an RPC service without registering with portmapper NeilBrown
2006-12-12 23:58 ` [PATCH 003 of 14] knfsd: SUNRPC: Cache remote peer's address in svc_sock NeilBrown
2006-12-12 23:58 ` [PATCH 004 of 14] knfsd: SUNRPC: Don't set msg_name and msg_namelen when calling sock_recvmsg NeilBrown
2006-12-12 23:58 ` [PATCH 005 of 14] knfsd: SUNRPC: Use sockaddr_storage to store address in svc_deferred_req NeilBrown
2006-12-12 23:59 ` [PATCH 006 of 14] knfsd: SUNRPC: Add a function to format the address in an svc_rqst for printing NeilBrown
2006-12-12 23:59 ` [PATCH 007 of 14] knfsd: SUNRPC: Provide room in svc_rqst for larger addresses NeilBrown
2006-12-15 4:30 ` Andrew Morton
2006-12-12 23:59 ` [PATCH 008 of 14] knfsd: SUNRPC: Make rq_daddr field address-version independent NeilBrown
2006-12-12 23:59 ` [PATCH 009 of 14] knfsd: SUNRPC: teach svc_sendto() to deal with IPv6 addresses NeilBrown
2006-12-17 15:15 ` Ingo Oeser
2006-12-12 23:59 ` [PATCH 010 of 14] knfsd: SUNRPC: add a "generic" function to see if the peer uses a secure port NeilBrown
2006-12-13 1:42 ` Andrew Morton
2006-12-13 20:26 ` [NFS] " Chuck Lever
2006-12-12 23:59 ` [PATCH 011 of 14] knfsd: SUNRPC: Support IPv6 addresses in svc_tcp_accept NeilBrown
2006-12-12 23:59 ` [PATCH 012 of 14] knfsd: SUNRPC: support IPv6 addresses in RPC server's UDP receive path NeilBrown
2006-12-12 23:59 ` [PATCH 013 of 14] knfsd: SUNRPC: fix up svc_create_socket() to take a sockaddr struct + length NeilBrown
2006-12-12 23:59 ` NeilBrown [this message]
2006-12-13 5:40 ` [PATCH 000 of 14] knfsd: Assorted nfsd patches for 2.6.20 - prepare for IPv6 and more Jeff Garzik
2006-12-13 11:13 ` Neil Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1061212235949.21551@suse.de \
--to=neilb@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nfs@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox