Since there isn't really a share flag which says "this share is writable" (the access mask returned in tcon is only for that user - not for any user), we could do the reverse ie forbid it if the server forbids it, but otherwise just warn on it: See e.g. SMB2_SHAREFLAG_NO_CACHING Offline caching MUST NOT occur. On Wed, Aug 28, 2019 at 5:27 AM ronnie sahlberg <ronniesahlberg@xxxxxxxxx> wrote: > > On Wed, Aug 28, 2019 at 8:21 PM Aurélien Aptel <aaptel@xxxxxxxx> wrote: > > > > "Steve French" <smfrench@xxxxxxxxx> writes: > > > Increases performance a lot in cases where we know that the share is > > > not changing > > > > This is just adding the parsing of the option but it sounds like a good idea. > > You also have the magic happening in: > -#define CIFS_CACHE_READ(cinode) (cinode->oplock & CIFS_CACHE_READ_FLG) > +#define CIFS_CACHE_READ(cinode) ((cinode->oplock & > CIFS_CACHE_READ_FLG) || > (CIFS_SB(cinode->vfs_inode.i_sb)->mnt_cifs_flags & > CIFS_MOUNT_RO_CACHE)) > > which makes things work. Still I would want this to be driven by > whether the server returns "this share is WRITEABLE or not" flag > instead of a mount option. > A mount option only invites people to "I use this because it makes > thing faster" then "why do my files look corrupted sometimes" ? > > > > > > +#define CIFS_MOUNT_RO_CACHE 0x20000000 /* assumes share will not change */ > > > > This flag probably needs to be added to CIFS_MOUNT_MASK: if one cifs sb > > is using that flag, it should only be reused for new mounts that also > > require that flag. > > > > Cheers, > > > > -- > > Aurélien Aptel / SUSE Labs Samba Team > > GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3 > > SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE > > GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München) -- Thanks, Steve