]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commit
mds: ensure that change_attr reflects metadata changes on clients that hold CAP_FILE_EXCL
authorJeff Layton <jlayton@redhat.com>
Mon, 29 Aug 2016 14:33:10 +0000 (10:33 -0400)
committerJeff Layton <jlayton@redhat.com>
Mon, 29 Aug 2016 14:33:10 +0000 (10:33 -0400)
commit902566840bedba0b3115e704291a3f1131b1904f
tree804505c6ca2d799a969b75fcbc8a72ba30db8fbd
parentd3ff304a7aab6563b0e5d45585fdb1cd64309d0f
mds: ensure that change_attr reflects metadata changes on clients that hold CAP_FILE_EXCL

Suppose we have two clients. client1 holds FILE_EXCL cap and client2
holds AUTH_EXCL.  Both have the change_attr at the same value (call it
1).  client1 does 2 writes and its change_attr goes to 3. The client1
then queries for the change_attr and gets back 3 from the cache. The MDS
then recalls FILE_EXCL from client1 and now the MDS and client1 have the
same change_attr (3).

client2 then does a chmod on the file, and its change_attr goes to 2.
client1 then does a statx with STX_VERSION|STX_MODE. The MDS recalls the
AUTH_EXCL cap from client2, the change_attr in the MClientCaps is less
than the one in the MDS inode, so it gets discarded. client1 then sees
a new mode but the change_attr value has not changed, which violates the
rules.

Fix this with an extra increment of the MDS copy of the change_attr when
the caps being returned are dirty, and they don't contain exclusive write
caps.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
src/mds/Locker.cc