diff options
| author | Rajesh Joseph <rjoseph@redhat.com> | 2014-12-08 14:25:22 +0530 | 
|---|---|---|
| committer | Raghavendra Bhat <raghavendra@redhat.com> | 2015-01-08 01:40:33 -0800 | 
| commit | ea25ad8762bf40698f92567c273cfb8daebd6513 (patch) | |
| tree | df60d300fdf5ec61a872e950ca859d463a250315 /api | |
| parent | b55c8920b50fff18937b2ab213e2b168f534a84e (diff) | |
gfapi: new inode created in glfs_resolve_component even if inode is in inode table
        Backport of http://review.gluster.org/#/c/9253/
problem: USS allows split-brain file to be accessed while main volume
         gives I/O error.
cause:
        AFR detects split-brain on lookup. It stores this information in
        inode context. open and readv fop checks this flag from inode context.
        open and readv fop fails if split-brain flag is set for the file.
        USS uses gfapi to access snapshot volume. During open call
        gfapi internally calls glfs_resolve_component. glfs_resolve_component
        generates a new inode even if inode is present for the file.
        Because of which afr_lookup acts on a new inode which does not
        contain the split-brain flag.
Change-Id: I56233e1436036783eaf6012034842e52122e981e
Signed-off-by: Rajesh Joseph <rjoseph@redhat.com>
Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-on: http://review.gluster.org/9415
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'api')
| -rw-r--r-- | api/src/glfs-resolve.c | 10 | 
1 files changed, 4 insertions, 6 deletions
diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c index e3f14f9a364..7aa5cc6158e 100644 --- a/api/src/glfs-resolve.c +++ b/api/src/glfs-resolve.c @@ -246,12 +246,10 @@ glfs_resolve_component (struct glfs *fs, xlator_t *subvol, inode_t *parent,             Fill loc.name so that we make use md-cache.             md-cache is not valid for nameless lookups.          */ -        if (__is_root_gfid (parent->gfid)) { -                if ((strcmp (component, ".") == 0) || -                    (strcmp (component, "..") == 0)) { -                        loc.inode = inode_ref (parent); -                        loc.name = "."; -                } +        if (__is_root_gfid (parent->gfid) && +            (strcmp (component, "..") == 0)) { +                loc.inode = inode_ref (parent); +                loc.name = ".";          } else {                  if (strcmp (component, ".") == 0)                          loc.inode = inode_ref (parent);  | 
