diff options
author | Steve French <sfrench@us.ibm.com> | 2008-12-02 12:24:33 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2008-12-25 21:29:10 -0500 |
commit | 13a6e42af8d90e2e8eb7fa50adf862a525b70518 (patch) | |
tree | 5d6021da7bc49b75cca5a0947f89bde7233ebce4 /fs/cifs/connect.c | |
parent | d5c5605c27c92dac6de1a7a658af5b030847f949 (diff) |
[CIFS] add mount option to send mandatory rather than advisory locks
Some applications/subsystems require mandatory byte range locks
(as is used for Windows/DOS/OS2 etc). Sending advisory (posix style)
byte range lock requests (instead of mandatory byte range locks) can
lead to problems for these applications (which expect that other
clients be prevented from writing to portions of the file which
they have locked and are updating). This mount option allows
mounting cifs with the new mount option "forcemand" (or
"forcemandatorylock") in order to have the cifs client use mandatory
byte range locks (ie SMB/CIFS/Windows/NTFS style locks) rather than
posix byte range lock requests, even if the server would support
posix byte range lock requests. This has no effect if the server
does not support the CIFS Unix Extensions (since posix style locks
require support for the CIFS Unix Extensions), but for mounts
to Samba servers this can be helpful for Wine and applications
that require mandatory byte range locks.
Acked-by: Jeff Layton <jlayton@redhat.com>
CC: Alexander Bokovoy <ab@samba.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r-- | fs/cifs/connect.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index d6a3c1c8a6f8..351942042833 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -89,6 +89,7 @@ struct smb_vol { | |||
89 | bool nullauth:1; /* attempt to authenticate with null user */ | 89 | bool nullauth:1; /* attempt to authenticate with null user */ |
90 | bool nocase:1; /* request case insensitive filenames */ | 90 | bool nocase:1; /* request case insensitive filenames */ |
91 | bool nobrl:1; /* disable sending byte range locks to srv */ | 91 | bool nobrl:1; /* disable sending byte range locks to srv */ |
92 | bool mand_lock:1; /* send mandatory not posix byte range lock reqs */ | ||
92 | bool seal:1; /* request transport encryption on share */ | 93 | bool seal:1; /* request transport encryption on share */ |
93 | bool nodfs:1; /* Do not request DFS, even if available */ | 94 | bool nodfs:1; /* Do not request DFS, even if available */ |
94 | bool local_lease:1; /* check leases only on local system, not remote */ | 95 | bool local_lease:1; /* check leases only on local system, not remote */ |
@@ -1246,6 +1247,17 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1246 | if (vol->file_mode == | 1247 | if (vol->file_mode == |
1247 | (S_IALLUGO & ~(S_ISUID | S_IXGRP))) | 1248 | (S_IALLUGO & ~(S_ISUID | S_IXGRP))) |
1248 | vol->file_mode = S_IALLUGO; | 1249 | vol->file_mode = S_IALLUGO; |
1250 | } else if (strnicmp(data, "forcemandatorylock", 9) == 0) { | ||
1251 | /* will take the shorter form "forcemand" as well */ | ||
1252 | /* This mount option will force use of mandatory | ||
1253 | (DOS/Windows style) byte range locks, instead of | ||
1254 | using posix advisory byte range locks, even if the | ||
1255 | Unix extensions are available and posix locks would | ||
1256 | be supported otherwise. If Unix extensions are not | ||
1257 | negotiated this has no effect since mandatory locks | ||
1258 | would be used (mandatory locks is all that those | ||
1259 | those servers support) */ | ||
1260 | vol->mand_lock = 1; | ||
1249 | } else if (strnicmp(data, "setuids", 7) == 0) { | 1261 | } else if (strnicmp(data, "setuids", 7) == 0) { |
1250 | vol->setuids = 1; | 1262 | vol->setuids = 1; |
1251 | } else if (strnicmp(data, "nosetuids", 9) == 0) { | 1263 | } else if (strnicmp(data, "nosetuids", 9) == 0) { |
@@ -2150,6 +2162,8 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info, | |||
2150 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_UNX_EMUL; | 2162 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_UNX_EMUL; |
2151 | if (pvolume_info->nobrl) | 2163 | if (pvolume_info->nobrl) |
2152 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_BRL; | 2164 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_BRL; |
2165 | if (pvolume_info->mand_lock) | ||
2166 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NOPOSIXBRL; | ||
2153 | if (pvolume_info->cifs_acl) | 2167 | if (pvolume_info->cifs_acl) |
2154 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_ACL; | 2168 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_ACL; |
2155 | if (pvolume_info->override_uid) | 2169 | if (pvolume_info->override_uid) |