On Sun, Nov 4, 2018 at 10:31 AM Marvin Zhang <fanzier@xxxxxxxxx> wrote: > > Hi guys, > They look very similar from defination. Can anyone tell me the difference? > > Here are defination: > #define CEPH_CAP_FILE_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SFILE) > #define CEPH_CAP_FILE_RD (CEPH_CAP_GRD << CEPH_CAP_SFILE) > > #define CEPH_CAP_GSHARED 1 /* client can reads */ > #define CEPH_CAP_GRD 8 /* (file) client can read */ IIRC, GSHARED applies to all capability types (Authority, Xattr, File, and whatever I'm forgetting) whereas GRD is just for File. In terms of FILE_SHARED versus FILE_RD: FILE_RD means the client is allowed to actually do data reads to the OSDs. FILE_SHARED relates to...whatever else that cap covers? Maybe the layout or file size? In particular, if multiple clients hold a file open and are doing activity on it, they will hold the Fs (FILE_SHARED) cap throughout the duration. But if one client is doing reads and one client is doing writes, the reader will be granted the Fr (FILE_RD) cap to perform its reads, and then have Fr revoked while its opposite number is granted Fw (FILE_WR) in order to perform writes. -Greg