gfapi: new inode created in glfs_resolve_component even if inode is in inode table

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.

Bug: 1171615

Change-Id: I1b4fddf4bd3c734a319ecfae804a3439866d157c
Signed-off-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-on: http://review.gluster.org/9253
Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-by: Poornima G <pgurusid@redhat.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Rajesh Joseph 2014-12-08 14:25:22 +05:30 committed by Niels de Vos
parent cd6ffa93dc
commit 6b83a658ed

View File

@ -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);