[Gluster-devel] regarding fsetattr

Pranith Kumar Karampuri pkarampu at redhat.com
Thu May 29 14:31:25 UTC 2014



----- Original Message -----
> From: "Pranith Kumar Karampuri" <pkarampu at redhat.com>
> To: "jGluster Devel" <gluster-devel at gluster.org>
> Sent: Thursday, May 29, 2014 3:37:37 PM
> Subject: Re: [Gluster-devel] regarding fsetattr
> 
> 
> 
> ----- Original Message -----
> > From: "Pranith Kumar Karampuri" <pkarampu at redhat.com>
> > To: "jGluster Devel" <gluster-devel at gluster.org>
> > Cc: "Brian Foster" <bfoster at redhat.com>
> > Sent: Thursday, May 29, 2014 3:08:33 PM
> > Subject: regarding fsetattr
> > 
> > hi,
> >    When I run the following program on fuse mount it fails with ENOENT.
> >    When
> >    I look at the mount logs, it prints error for setattr instead of
> >    fsetattr. Wondering anyone knows why the fop comes as setattr instead of
> >    fsetattr.
> > 
> > Log:
> > [2014-05-29 09:33:38.658023] W [fuse-bridge.c:1056:fuse_setattr_cbk]
> > 0-glusterfs-fuse: 2569: SETATTR()
> > <gfid:ae44dd74-ff45-42a8-886e-b4ce2373a267> => -1 (No such file or
> > directory)
> > 
> > Program:
> > #include <stdio.h>
> > #include <unistd.h>
> > #include <sys/types.h>
> > #include <sys/stat.h>
> > #include <fcntl.h>
> > #include <errno.h>
> > #include <string.h>
> > 
> > 
> > int
> > main ()
> > {
> >         int ret = 0;
> >         int fd=open("a.txt", O_CREAT|O_RDWR);
> > 
> >         if (fd < 0)
> >                 printf ("open failed: %s\n", strerror(errno));
> >         ret = unlink("a.txt");
> >         if (ret < 0)
> >                 printf ("unlink failed: %s\n", strerror(errno));
> >         if (write (fd, "abc", 3) < 0)
> >                 printf ("Not able to print %s\n", strerror (errno));
> >         ret = fchmod (fd, S_IRUSR|S_IWUSR|S_IXUSR);
> >         if (ret < 0)
> >                 printf ("fchmod failed %s\n", strerror(errno));
> >         return 0;
> > }
> 
> Based on vijay's inputs I checked in fuse-brige and this is what I see:
> 1162	        if (fsi->valid & FATTR_FH &&
> 1163	            !(fsi->valid & (FATTR_ATIME|FATTR_MTIME))) {
> 1164	                /* We need no loc if kernel sent us an fd and
> 1165	                 * we are not fiddling with times */
> 1166	                state->fd = FH_TO_FD (fsi->fh);
> (gdb)
> 1167	                fuse_resolve_fd_init (state, &state->resolve,
> state->fd);
> 1168	        } else {
> 1169	                fuse_resolve_inode_init (state, &state->resolve,
> finh->nodeid);
> 1170	        }
> 1171
> 
> (gdb) p fsi->valid
> $4 = 1
> (gdb) p (fsi->valid & FATTR_FH)
> $5 = 0
> (gdb)
> 
> fsi->valid doesn't have FATTR_FH. Who is supposed to set it?

had a discussion with brian foster on IRC.
The issue is that gluster depends on client fd to be passed down to perform the operations where as setattr is sent on an inode from vfs to fuse and since gluster doesn't have any reference to inode once unlink happens, this issue is seen. I will have one more conversation with brian to find what needs to be fixed.

Pranith.

> 
> Pranith
> > 
> > Pranith
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel at gluster.org
> http://supercolony.gluster.org/mailman/listinfo/gluster-devel
> 


More information about the Gluster-devel mailing list