diff options
author | Steve French <sfrench@us.ibm.com> | 2009-02-23 10:21:59 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2009-03-11 21:36:20 -0400 |
commit | be652445fdccb8e5d4391928c3b45324ea37f9e1 (patch) | |
tree | 9912b7022b06d3ad08ff73d71505f018fe96922b /fs | |
parent | 10e70afa75c90702b2326abaaa757d6b7835636f (diff) |
[CIFS] Add new nostrictsync cifs mount option to avoid slow SMB flush
If this mount option is set, when an application does an
fsync call then the cifs client does not send an SMB Flush
to the server (to force the server to write all dirty data
for this file immediately to disk), although cifs still sends
all dirty (cached) file data to the server and waits for the
server to respond to the write write. Since SMB Flush can be
very slow, and some servers may be reliable enough (to risk
delaying slightly flushing the data to disk on the server),
turning on this option may be useful to improve performance for
applications that fsync too much, at a small risk of server
crash. If this mount option is not set, by default cifs will
send an SMB flush request (and wait for a response) on every
fsync call.
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/CHANGES | 4 | ||||
-rw-r--r-- | fs/cifs/README | 22 | ||||
-rw-r--r-- | fs/cifs/cifs_fs_sb.h | 1 | ||||
-rw-r--r-- | fs/cifs/connect.c | 7 | ||||
-rw-r--r-- | fs/cifs/file.c | 3 |
5 files changed, 31 insertions, 6 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index d43e0fe33398..b33c8412e2c8 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -8,7 +8,9 @@ user's smb session. This fix allows cifs to mount multiple times to the | |||
8 | same server with different userids without risking invalidating earlier | 8 | same server with different userids without risking invalidating earlier |
9 | established security contexts. fsync now sends SMB Flush operation | 9 | established security contexts. fsync now sends SMB Flush operation |
10 | to better ensure that we wait for server to write all of the data to | 10 | to better ensure that we wait for server to write all of the data to |
11 | server disk (not just write it over the network). | 11 | server disk (not just write it over the network). Add new mount |
12 | parameter to allow user to disable sending the (slow) SMB flush on | ||
13 | fsync if desired (fsync still flushes all cached write data to the server). | ||
12 | 14 | ||
13 | Version 1.56 | 15 | Version 1.56 |
14 | ------------ | 16 | ------------ |
diff --git a/fs/cifs/README b/fs/cifs/README index da4515e3be20..07434181623b 100644 --- a/fs/cifs/README +++ b/fs/cifs/README | |||
@@ -472,6 +472,19 @@ A partial list of the supported mount options follows: | |||
472 | even if the cifs server would support posix advisory locks. | 472 | even if the cifs server would support posix advisory locks. |
473 | "forcemand" is accepted as a shorter form of this mount | 473 | "forcemand" is accepted as a shorter form of this mount |
474 | option. | 474 | option. |
475 | nostrictsync If this mount option is set, when an application does an | ||
476 | fsync call then the cifs client does not send an SMB Flush | ||
477 | to the server (to force the server to write all dirty data | ||
478 | for this file immediately to disk), although cifs still sends | ||
479 | all dirty (cached) file data to the server and waits for the | ||
480 | server to respond to the write. Since SMB Flush can be | ||
481 | very slow, and some servers may be reliable enough (to risk | ||
482 | delaying slightly flushing the data to disk on the server), | ||
483 | turning on this option may be useful to improve performance for | ||
484 | applications that fsync too much, at a small risk of server | ||
485 | crash. If this mount option is not set, by default cifs will | ||
486 | send an SMB flush request (and wait for a response) on every | ||
487 | fsync call. | ||
475 | nodfs Disable DFS (global name space support) even if the | 488 | nodfs Disable DFS (global name space support) even if the |
476 | server claims to support it. This can help work around | 489 | server claims to support it. This can help work around |
477 | a problem with parsing of DFS paths with Samba server | 490 | a problem with parsing of DFS paths with Samba server |
@@ -692,13 +705,14 @@ require this helper. Note that NTLMv2 security (which does not require the | |||
692 | cifs.upcall helper program), instead of using Kerberos, is sufficient for | 705 | cifs.upcall helper program), instead of using Kerberos, is sufficient for |
693 | some use cases. | 706 | some use cases. |
694 | 707 | ||
695 | Enabling DFS support (used to access shares transparently in an MS-DFS | 708 | DFS support allows transparent redirection to shares in an MS-DFS name space. |
696 | global name space) requires that CONFIG_CIFS_EXPERIMENTAL be enabled. In | 709 | In addition, DFS support for target shares which are specified as UNC |
697 | addition, DFS support for target shares which are specified as UNC | ||
698 | names which begin with host names (rather than IP addresses) requires | 710 | names which begin with host names (rather than IP addresses) requires |
699 | a user space helper (such as cifs.upcall) to be present in order to | 711 | a user space helper (such as cifs.upcall) to be present in order to |
700 | translate host names to ip address, and the user space helper must also | 712 | translate host names to ip address, and the user space helper must also |
701 | be configured in the file /etc/request-key.conf | 713 | be configured in the file /etc/request-key.conf. Samba, Windows servers and |
714 | many NAS appliances support DFS as a way of constructing a global name | ||
715 | space to ease network configuration and improve reliability. | ||
702 | 716 | ||
703 | To use cifs Kerberos and DFS support, the Linux keyutils package should be | 717 | To use cifs Kerberos and DFS support, the Linux keyutils package should be |
704 | installed and something like the following lines should be added to the | 718 | installed and something like the following lines should be added to the |
diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h index c4c306f7b06f..e9f177bb0658 100644 --- a/fs/cifs/cifs_fs_sb.h +++ b/fs/cifs/cifs_fs_sb.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #define CIFS_MOUNT_OVERR_GID 0x800 /* override gid returned from server */ | 32 | #define CIFS_MOUNT_OVERR_GID 0x800 /* override gid returned from server */ |
33 | #define CIFS_MOUNT_DYNPERM 0x1000 /* allow in-memory only mode setting */ | 33 | #define CIFS_MOUNT_DYNPERM 0x1000 /* allow in-memory only mode setting */ |
34 | #define CIFS_MOUNT_NOPOSIXBRL 0x2000 /* mandatory not posix byte range lock */ | 34 | #define CIFS_MOUNT_NOPOSIXBRL 0x2000 /* mandatory not posix byte range lock */ |
35 | #define CIFS_MOUNT_NO_SSYNC 0x4000 /* don't do slow SMBflush on every sync*/ | ||
35 | 36 | ||
36 | struct cifs_sb_info { | 37 | struct cifs_sb_info { |
37 | struct cifsTconInfo *tcon; /* primary mount */ | 38 | struct cifsTconInfo *tcon; /* primary mount */ |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index da0f4ffa0613..18e84a4e0504 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -95,6 +95,7 @@ struct smb_vol { | |||
95 | 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 */ |
96 | bool noblocksnd:1; | 96 | bool noblocksnd:1; |
97 | bool noautotune:1; | 97 | bool noautotune:1; |
98 | bool nostrictsync:1; /* do not force expensive SMBflush on every sync */ | ||
98 | unsigned int rsize; | 99 | unsigned int rsize; |
99 | unsigned int wsize; | 100 | unsigned int wsize; |
100 | unsigned int sockopt; | 101 | unsigned int sockopt; |
@@ -1274,6 +1275,10 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1274 | vol->intr = 0; | 1275 | vol->intr = 0; |
1275 | } else if (strnicmp(data, "intr", 4) == 0) { | 1276 | } else if (strnicmp(data, "intr", 4) == 0) { |
1276 | vol->intr = 1; | 1277 | vol->intr = 1; |
1278 | } else if (strnicmp(data, "nostrictsync", 12) == 0) { | ||
1279 | vol->nostrictsync = 1; | ||
1280 | } else if (strnicmp(data, "strictsync", 10) == 0) { | ||
1281 | vol->nostrictsync = 0; | ||
1277 | } else if (strnicmp(data, "serverino", 7) == 0) { | 1282 | } else if (strnicmp(data, "serverino", 7) == 0) { |
1278 | vol->server_ino = 1; | 1283 | vol->server_ino = 1; |
1279 | } else if (strnicmp(data, "noserverino", 9) == 0) { | 1284 | } else if (strnicmp(data, "noserverino", 9) == 0) { |
@@ -2160,6 +2165,8 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info, | |||
2160 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_UNX_EMUL; | 2165 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_UNX_EMUL; |
2161 | if (pvolume_info->nobrl) | 2166 | if (pvolume_info->nobrl) |
2162 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_BRL; | 2167 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_BRL; |
2168 | if (pvolume_info->nostrictsync) | ||
2169 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_SSYNC; | ||
2163 | if (pvolume_info->mand_lock) | 2170 | if (pvolume_info->mand_lock) |
2164 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NOPOSIXBRL; | 2171 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NOPOSIXBRL; |
2165 | if (pvolume_info->cifs_acl) | 2172 | if (pvolume_info->cifs_acl) |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 83b4741b6ad0..6411f5f65d72 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -1538,7 +1538,8 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync) | |||
1538 | rc = CIFS_I(inode)->write_behind_rc; | 1538 | rc = CIFS_I(inode)->write_behind_rc; |
1539 | CIFS_I(inode)->write_behind_rc = 0; | 1539 | CIFS_I(inode)->write_behind_rc = 0; |
1540 | tcon = CIFS_SB(inode->i_sb)->tcon; | 1540 | tcon = CIFS_SB(inode->i_sb)->tcon; |
1541 | if (!rc && tcon && smbfile) | 1541 | if (!rc && tcon && smbfile && |
1542 | !(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_SSYNC)) | ||
1542 | rc = CIFSSMBFlush(xid, tcon, smbfile->netfid); | 1543 | rc = CIFSSMBFlush(xid, tcon, smbfile->netfid); |
1543 | } | 1544 | } |
1544 | 1545 | ||