Skip to contentSkip to conversation

ceph_fsal_setattr2 returned Operation not permitted

NFS-Ganesha-Devel Frank Filz 2 participants 2 messages Sep 18, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Frank Filz

author
#1 lore raw
In reply to a message not in the archive

Ah, when FSAL_CEPH was written, Ceph didn't have CEPH_SETATTR_ATIME_NOW = and CEPH_SETATTR_MTIME_NOW. Now that they are available, we should use = them. We may need to conditional compile.

Frank

Quoted 5 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Monday, September 17, 2018 4:39 AM
To: [email protected]; [email protected]
Subject: [NFS-Ganesha-Devel] [NFS-Ganesha-Devel]ceph_fsal_setattr2 =

returned

Quoted 4 lines

Operation not permitted
=20
How to reproduce:
1. mount the nfs-ganesha export directory with NFSV3 2. create new =

users:

Quoted 3 lines

user1 and user2, there is the same user group for user1 and user2

    uid=3D9998(user1) gid=3D100(users) groups=3D100(users)
    uid=3D9997(user2) gid=3D100(users) groups=3D100(users) 3. log in =

using user1 and

Quoted 1 line

create new file named abc.txt 4. chmod 664 abc.txt 5. log in using =

user2, and

Quoted 8 lines

write new content to abc.txt
echo 'Hello' > abc.txt
6. The error "Operation not permitted" will be output =20
Expected result:
user2 may write data to file abc.txt successfully. =20
The more detailed info could be found in =

http://tracker.ceph.com/issues/35961

Quoted 1 line

The issue may be fixed by changing the following code, is it =

appropriate changes

Quoted 4 lines

for fixing the issue?
=20
src\FSAL\FSAL_CEPH\handle.c
fsal_status_t ceph_setattr2(struct fsal_obj_handle *obj_hdl, bool =

bypass, struct

Quoted 12 lines

state_t *state, struct attrlist *attrib_set) { ...

	if (FSAL_TEST_MASK(attrib_set->valid_mask, ATTR_ATIME_SERVER)) {
		struct timespec timestamp;
mask |=3D CEPH_SETATTR_ATIME;  //
s/CEPH_SETATTR_ATIME/CEPH_SETATTR_ATIME_NOW
...
if (FSAL_TEST_MASK(attrib_set->valid_mask, ATTR_MTIME_SERVER)) {
		struct timespec timestamp;

mask |=3D CEPH_SETATTR_MTIME; //
s/CEPH_SETATTR_MTIME/CEPH_SETATTR_MTIME_NOW
...
}

#2 lore raw
In reply to a message not in the archive
Quoted 27 lines · On Mon, 2018-09-17 at 19:39 +0800, [email protected] wrote:

How to reproduce:
1. mount the nfs-ganesha export directory with NFSV3
2. create new users: user1 and user2, there is the same user group for user1 and user2

    uid=9998(user1) gid=100(users) groups=100(users)
    uid=9997(user2) gid=100(users) groups=100(users)

3. log in using user1 and create new file named abc.txt
4. chmod 664 abc.txt
5. log in using user2, and write new content to abc.txt echo 'Hello' > abc.txt
6. The error "Operation not permitted" will be output

Expected result:
user2 may write data to file abc.txt successfully.

The more detailed info could be found in http://tracker.ceph.com/issues/35961
The issue may be fixed by changing the following code, is it appropriate changes for fixing the issue?

src\FSAL\FSAL_CEPH\handle.c
fsal_status_t ceph_setattr2(struct fsal_obj_handle *obj_hdl, bool bypass, struct state_t *state, struct attrlist *attrib_set) {
...

	if (FSAL_TEST_MASK(attrib_set->valid_mask, ATTR_ATIME_SERVER)) {
		struct timespec timestamp;
mask |= CEPH_SETATTR_ATIME;  // s/CEPH_SETATTR_ATIME/CEPH_SETATTR_ATIME_NOW
...
if (FSAL_TEST_MASK(attrib_set->valid_mask, ATTR_MTIME_SERVER)) {
		struct timespec timestamp;
Quoted 3 lines

mask |= CEPH_SETATTR_MTIME; // s/CEPH_SETATTR_MTIME/CEPH_SETATTR_MTIME_NOW
...
}]

If I'm reading the ceph code right, then we need to do:

    mask |= CEPH_SETATTR_MTIME|CEPH_SETATTR_MTIME_NOW;

The *_NOW fields just override how permissions are checked.

Signature · 1 line
Jeff Layton <[email protected]>