On Thu, 16 Aug 2012, Miklos Szeredi wrote: > Miklos Szeredi <miklos@xxxxxxxxxx> writes: > > > Sage Weil <sage@xxxxxxxxxxx> writes: > > > >> Hi Miklos, > >> > >> I found some time to track down the O_CREAT error code issue. Patch is > >> below. Does this look correct? > >> > >> I was reproducing with > >> > >> ceph-fuse mnt > >> mkdir -p mnt/a > >> cd mnt > >> .../pjd-fstest-20080816/fstest -u 65534 -g 65534 open a/foo O_RDONLY,O_CREAT 0644 > >> > >> EACCES is expected, ENOENT was returned instead. > > > > I don't quite undersdand what is happending here. > > > > Why does ceph-fuse return ENOENT here? Returning ENOENT for O_CREAT > > only makes sense if the parent directory doesn't exist, but that's not > > the case here. > > More specifically, the initial lookup will return ENOENT, that's fine. > > But in that case fuse_atomic_open() will do a FUSE_CREATE for which > ENOENT is not the right answer. I didn't dig deeply into what fuse_lookup() itself was doing, but the short version is: - namei.c's atomic_open() gets -EACCES from the may_o_create() check, sets create_error, and clears O_CREAT from the flags - fuse_atomic_open() calls fuse_lookup(), which returns NULL and leaves entry->d_inode == NULL. ceph-fuse's lookup method returned -ENOENT. fuse_lookup() is just hashing the negative dentry instead of returning ENOENT. - fuse_atomic_open() sees O_CREAT is not set and calls finish_no_open(). - the existing ENOENT -> EACCES check in atomic_open() (below) fails because fuse_atomic_open() returned 1: if (error < 0) { if (create_error && error == -ENOENT) error = create_error; goto out; } This patch just applies the same ENOENT->EACCES logic to the equivalent negative/null dentry case. > Can you post the relevant part from the filesytem's debug log? The relevant bit is unique: 11, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 8502 unique: 11, success, outsize: 120 unique: 12, opcode: LOOKUP (1), nodeid: 1, insize: 42, pid: 8502 unique: 12, success, outsize: 144 unique: 13, opcode: GETATTR (3), nodeid: 1099511627776, insize: 56, pid: 8502 unique: 13, success, outsize: 120 unique: 14, opcode: GETATTR (3), nodeid: 1099511627776, insize: 56, pid: 8502 unique: 14, success, outsize: 120 unique: 15, opcode: LOOKUP (1), nodeid: 1099511627776, insize: 45, pid: 8502 unique: 15, error: -2 (No such file or directory), outsize: 16 Thanks- sage -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html