summaryrefslogtreecommitdiffstats
path: root/xlators/nfs
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/nfs')
-rw-r--r--xlators/nfs/server/src/mount3.c19
-rw-r--r--xlators/nfs/server/src/nfs-common.c11
-rw-r--r--xlators/nfs/server/src/nfs-common.h4
-rw-r--r--xlators/nfs/server/src/nfs3-helpers.c9
4 files changed, 28 insertions, 15 deletions
diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c
index 2b9a75ee2cc..7b49d097d96 100644
--- a/xlators/nfs/server/src/mount3.c
+++ b/xlators/nfs/server/src/mount3.c
@@ -1057,8 +1057,9 @@ __mnt3_resolve_export_subdir_comp (mnt3_resolve_t *mres)
/* Wipe the contents of the previous component */
gf_uuid_copy (gfid, mres->resolveloc.inode->gfid);
nfs_loc_wipe (&mres->resolveloc);
- ret = nfs_entry_loc_fill (mres->exp->vol->itable, gfid, nextcomp,
- &mres->resolveloc, NFS_RESOLVE_CREATE);
+ ret = nfs_entry_loc_fill (mres->mstate->nfsx, mres->exp->vol->itable,
+ gfid, nextcomp, &mres->resolveloc,
+ NFS_RESOLVE_CREATE);
if ((ret < 0) && (ret != -2)) {
gf_msg (GF_MNT, GF_LOG_ERROR, EFAULT,
NFS_MSG_RESOLVE_INODE_FAIL, "Failed to resolve and "
@@ -1118,6 +1119,7 @@ mnt3_resolve_subdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int authcode = 0;
char *authorized_host = NULL;
char *authorized_path = NULL;
+ inode_t *linked_inode = NULL;
mres = frame->local;
ms = mres->mstate;
@@ -1134,8 +1136,12 @@ mnt3_resolve_subdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto err;
}
- inode_link (mres->resolveloc.inode, mres->resolveloc.parent,
- mres->resolveloc.name, buf);
+ linked_inode = inode_link (mres->resolveloc.inode,
+ mres->resolveloc.parent,
+ mres->resolveloc.name, buf);
+
+ if (linked_inode)
+ nfs_fix_generation (this, linked_inode);
nfs3_fh_build_child_fh (&mres->parentfh, buf, &fh);
if (strlen (mres->remainingdir) <= 0) {
@@ -1366,8 +1372,9 @@ __mnt3_resolve_subdir (mnt3_resolve_t *mres)
goto err;
rootgfid[15] = 1;
- ret = nfs_entry_loc_fill (mres->exp->vol->itable, rootgfid, firstcomp,
- &mres->resolveloc, NFS_RESOLVE_CREATE);
+ ret = nfs_entry_loc_fill (mres->mstate->nfsx, mres->exp->vol->itable,
+ rootgfid, firstcomp, &mres->resolveloc,
+ NFS_RESOLVE_CREATE);
if ((ret < 0) && (ret != -2)) {
gf_msg (GF_MNT, GF_LOG_ERROR, EFAULT,
NFS_MSG_RESOLVE_INODE_FAIL, "Failed to resolve and "
diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c
index 359835f2cbd..51a2b7e36f7 100644
--- a/xlators/nfs/server/src/nfs-common.c
+++ b/xlators/nfs/server/src/nfs-common.c
@@ -326,8 +326,8 @@ err:
* On other errors, return -3. 0 on success.
*/
int
-nfs_entry_loc_fill (inode_table_t *itable, uuid_t pargfid, char *entry,
- loc_t *loc, int how)
+nfs_entry_loc_fill (xlator_t *this, inode_table_t *itable, uuid_t pargfid,
+ char *entry, loc_t *loc, int how)
{
inode_t *parent = NULL;
inode_t *entryinode = NULL;
@@ -342,21 +342,22 @@ nfs_entry_loc_fill (inode_table_t *itable, uuid_t pargfid, char *entry,
ret = -1;
/* Will need hard resolution now */
- if (!parent)
+ if (!parent || inode_ctx_get (parent, this, NULL))
goto err;
gf_uuid_copy (loc->pargfid, pargfid);
ret = -2;
entryinode = inode_grep (itable, parent, entry);
- if (!entryinode) {
+ if (!entryinode || inode_ctx_get (entryinode, this, NULL)) {
if (how == NFS_RESOLVE_CREATE) {
/* Even though we'll create the inode and the loc for
* a missing inode, we still need to return -2 so
* that the caller can use the filled loc to call
* lookup.
*/
- entryinode = inode_new (itable);
+ if (!entryinode)
+ entryinode = inode_new (itable);
/* Cannot change ret because that must
* continue to have -2.
*/
diff --git a/xlators/nfs/server/src/nfs-common.h b/xlators/nfs/server/src/nfs-common.h
index d60642f6039..fa7f4ebf212 100644
--- a/xlators/nfs/server/src/nfs-common.h
+++ b/xlators/nfs/server/src/nfs-common.h
@@ -59,8 +59,8 @@ extern int
nfs_ino_loc_fill (inode_table_t *itable, uuid_t gfid, loc_t *l);
extern int
-nfs_entry_loc_fill (inode_table_t *itable, uuid_t pargfid, char *entry,
- loc_t *loc, int how);
+nfs_entry_loc_fill (xlator_t *this, inode_table_t *itable, uuid_t pargfid,
+ char *entry, loc_t *loc, int how);
extern int
nfs_root_loc_fill (inode_table_t *itable, loc_t *loc);
diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c
index 2203f1e1a90..cfa1ac64397 100644
--- a/xlators/nfs/server/src/nfs3-helpers.c
+++ b/xlators/nfs/server/src/nfs3-helpers.c
@@ -3655,6 +3655,7 @@ nfs3_fh_resolve_entry_lookup_cbk (call_frame_t *frame, void *cookie,
linked_inode = inode_link (inode, cs->resolvedloc.parent,
cs->resolvedloc.name, buf);
if (linked_inode) {
+ nfs_fix_generation (this, linked_inode);
inode_lookup (linked_inode);
inode_unref (cs->resolvedloc.inode);
cs->resolvedloc.inode = linked_inode;
@@ -3697,6 +3698,7 @@ nfs3_fh_resolve_inode_lookup_cbk (call_frame_t *frame, void *cookie,
linked_inode = inode_link (inode, cs->resolvedloc.parent,
cs->resolvedloc.name, buf);
if (linked_inode) {
+ nfs_fix_generation (this, linked_inode);
inode_lookup (linked_inode);
inode_unref (cs->resolvedloc.inode);
cs->resolvedloc.inode = linked_inode;
@@ -3766,7 +3768,7 @@ nfs3_fh_resolve_entry_hard (nfs3_call_state_t *cs)
", entry: %s", uuid_utoa (cs->resolvefh.gfid),
cs->resolventry);
- ret = nfs_entry_loc_fill (cs->vol->itable, cs->resolvefh.gfid,
+ ret = nfs_entry_loc_fill (cs->nfsx, cs->vol->itable, cs->resolvefh.gfid,
cs->resolventry, &cs->resolvedloc,
NFS_RESOLVE_CREATE);
@@ -3807,14 +3809,17 @@ nfs3_fh_resolve_inode (nfs3_call_state_t *cs)
{
inode_t *inode = NULL;
int ret = -EFAULT;
+ xlator_t *this = NULL;
if (!cs)
return ret;
+ this = cs->nfsx;
gf_msg_trace (GF_NFS3, 0, "FH needs inode resolution");
gf_uuid_copy (cs->resolvedloc.gfid, cs->resolvefh.gfid);
+
inode = inode_find (cs->vol->itable, cs->resolvefh.gfid);
- if (!inode)
+ if (!inode || inode_ctx_get (inode, this, NULL))
ret = nfs3_fh_resolve_inode_hard (cs);
else
ret = nfs3_fh_resolve_inode_done (cs, inode);