[Gluster-devel] regarding fsetattr
Pranith Kumar Karampuri
pkarampu at redhat.com
Thu May 29 10:07:37 UTC 2014
----- 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?
Pranith
>
> Pranith
More information about the Gluster-devel
mailing list