diff options
author | Gaurav <gaurav@gluster.com> | 2011-03-31 05:42:47 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-04-06 10:51:49 -0700 |
commit | b8ae8d95a814d9329c34e6bf3d705c0fc07115b7 (patch) | |
tree | d771b5db25932498e1243aaf64478521fce53435 /xlators/nfs/server/src/nfs3.c | |
parent | e4c5ad45612e845eb476b29d51ec12b963660855 (diff) |
NFS : Store verifier for exlusive mode craete.
Signed-off-by: Gaurav <gaurav@gluster.com>
Signed-off-by: Vijay Bellur <vijay@gluster.com>
BUG: 2553 (NFS file create with Mac client and UNCHECKED mode returns "Operation not permitted")
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2553
Diffstat (limited to 'xlators/nfs/server/src/nfs3.c')
-rw-r--r-- | xlators/nfs/server/src/nfs3.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c index 0f2c284ecaf..11b4ede17c7 100644 --- a/xlators/nfs/server/src/nfs3.c +++ b/xlators/nfs/server/src/nfs3.c @@ -2401,16 +2401,24 @@ nfs3svc_create_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto nfs3err; } - if (cs->preparent.ia_mtime == buf->ia_mtime) + if ((cs->stbuf.ia_mtime == buf->ia_mtime) && + (cs->stbuf.ia_atime == buf->ia_atime)) { + gf_log (GF_NFS3, GF_LOG_DEBUG, "Create req retransmitted verf %x %x", + cs->stbuf.ia_mtime, cs->stbuf.ia_atime); stat = NFS3_OK; - else + nfs3_fh_build_child_fh (&cs->parent, buf, &cs->fh); + } else { + gf_log (GF_NFS3, GF_LOG_DEBUG, "File already exist new_verf %x %x" + "old_verf %x %x", cs->stbuf.ia_mtime, cs->stbuf.ia_atime, + buf->ia_mtime, buf->ia_atime); stat = NFS3ERR_EXIST; + } nfs3err: if (ret < 0) { nfs3_log_common_res (nfs_rpcsvc_request_xid (cs->req), "CREATE", stat, op_errno); - nfs3_create_reply (cs->req, stat, NULL, NULL, NULL, NULL); + nfs3_create_reply (cs->req, stat, &cs->fh, buf, NULL, NULL); nfs3_call_state_wipe (cs); } @@ -2427,9 +2435,12 @@ nfs3_create_exclusive (nfs3_call_state_t *cs) if (!cs) return ret; - /* HACK warning. */ - cs->preparent.ia_mtime = cs->cookieverf; - cs->preparent.ia_atime = 9669; + /* Storing verifier as a mtime and atime attribute, to store it + * in stable storage */ + cs->stbuf.ia_atime = (cs->cookieverf && 0xFFFFFFFF00000000); + cs->stbuf.ia_mtime = (cs->cookieverf && 0x00000000FFFFFFFF); + cs->setattr_valid |= GF_SET_ATTR_ATIME; + cs->setattr_valid |= GF_SET_ATTR_MTIME; nfs_request_user_init (&nfu, cs->req); /* If the file already existed we need to get that attributes so we can |