diff options
-rw-r--r-- | fs/cifs/README | 9 | ||||
-rw-r--r-- | fs/cifs/cifs_fs_sb.h | 1 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 2 | ||||
-rw-r--r-- | fs/cifs/cifsglob.h | 10 | ||||
-rw-r--r-- | fs/cifs/connect.c | 15 | ||||
-rw-r--r-- | fs/cifs/inode.c | 7 |
6 files changed, 41 insertions, 3 deletions
diff --git a/fs/cifs/README b/fs/cifs/README index ee68d1036544..46af99ab3614 100644 --- a/fs/cifs/README +++ b/fs/cifs/README | |||
@@ -337,6 +337,15 @@ A partial list of the supported mount options follows: | |||
337 | wsize default write size (default 57344) | 337 | wsize default write size (default 57344) |
338 | maximum wsize currently allowed by CIFS is 57344 (fourteen | 338 | maximum wsize currently allowed by CIFS is 57344 (fourteen |
339 | 4096 byte pages) | 339 | 4096 byte pages) |
340 | actimeo=n attribute cache timeout in seconds (default 1 second). | ||
341 | After this timeout, the cifs client requests fresh attribute | ||
342 | information from the server. This option allows to tune the | ||
343 | attribute cache timeout to suit the workload needs. Shorter | ||
344 | timeouts mean better the cache coherency, but increased number | ||
345 | of calls to the server. Longer timeouts mean reduced number | ||
346 | of calls to the server at the expense of less stricter cache | ||
347 | coherency checks (i.e. incorrect attribute cache for a short | ||
348 | period of time). | ||
340 | rw mount the network share read-write (note that the | 349 | rw mount the network share read-write (note that the |
341 | server may still consider the share read-only) | 350 | server may still consider the share read-only) |
342 | ro mount network share read-only | 351 | ro mount network share read-only |
diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h index e9a393c9c2ca..7852cd677051 100644 --- a/fs/cifs/cifs_fs_sb.h +++ b/fs/cifs/cifs_fs_sb.h | |||
@@ -48,6 +48,7 @@ struct cifs_sb_info { | |||
48 | struct nls_table *local_nls; | 48 | struct nls_table *local_nls; |
49 | unsigned int rsize; | 49 | unsigned int rsize; |
50 | unsigned int wsize; | 50 | unsigned int wsize; |
51 | unsigned long actimeo; /* attribute cache timeout (jiffies) */ | ||
51 | atomic_t active; | 52 | atomic_t active; |
52 | uid_t mnt_uid; | 53 | uid_t mnt_uid; |
53 | gid_t mnt_gid; | 54 | gid_t mnt_gid; |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 76c8a906a63e..56a4b7544c3c 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -463,6 +463,8 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m) | |||
463 | 463 | ||
464 | seq_printf(s, ",rsize=%d", cifs_sb->rsize); | 464 | seq_printf(s, ",rsize=%d", cifs_sb->rsize); |
465 | seq_printf(s, ",wsize=%d", cifs_sb->wsize); | 465 | seq_printf(s, ",wsize=%d", cifs_sb->wsize); |
466 | /* convert actimeo and display it in seconds */ | ||
467 | seq_printf(s, ",actimeo=%lu", cifs_sb->actimeo / HZ); | ||
466 | 468 | ||
467 | return 0; | 469 | return 0; |
468 | } | 470 | } |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index b577bf0a1bb3..94ccfacaed8a 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -45,6 +45,16 @@ | |||
45 | #define CIFS_MIN_RCV_POOL 4 | 45 | #define CIFS_MIN_RCV_POOL 4 |
46 | 46 | ||
47 | /* | 47 | /* |
48 | * default attribute cache timeout (jiffies) | ||
49 | */ | ||
50 | #define CIFS_DEF_ACTIMEO (1 * HZ) | ||
51 | |||
52 | /* | ||
53 | * max attribute cache timeout (jiffies) - 2^30 | ||
54 | */ | ||
55 | #define CIFS_MAX_ACTIMEO (1 << 30) | ||
56 | |||
57 | /* | ||
48 | * MAX_REQ is the maximum number of requests that WE will send | 58 | * MAX_REQ is the maximum number of requests that WE will send |
49 | * on one socket concurrently. It also matches the most common | 59 | * on one socket concurrently. It also matches the most common |
50 | * value of max multiplex returned by servers. We may | 60 | * value of max multiplex returned by servers. We may |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 32fa4d9b5dbc..bb17ee2ba782 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -105,6 +105,7 @@ struct smb_vol { | |||
105 | unsigned int wsize; | 105 | unsigned int wsize; |
106 | bool sockopt_tcp_nodelay:1; | 106 | bool sockopt_tcp_nodelay:1; |
107 | unsigned short int port; | 107 | unsigned short int port; |
108 | unsigned long actimeo; /* attribute cache timeout (jiffies) */ | ||
108 | char *prepath; | 109 | char *prepath; |
109 | struct sockaddr_storage srcaddr; /* allow binding to a local IP */ | 110 | struct sockaddr_storage srcaddr; /* allow binding to a local IP */ |
110 | struct nls_table *local_nls; | 111 | struct nls_table *local_nls; |
@@ -840,6 +841,8 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
840 | /* default to using server inode numbers where available */ | 841 | /* default to using server inode numbers where available */ |
841 | vol->server_ino = 1; | 842 | vol->server_ino = 1; |
842 | 843 | ||
844 | vol->actimeo = CIFS_DEF_ACTIMEO; | ||
845 | |||
843 | if (!options) | 846 | if (!options) |
844 | return 1; | 847 | return 1; |
845 | 848 | ||
@@ -1214,6 +1217,16 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1214 | printk(KERN_WARNING "CIFS: server net" | 1217 | printk(KERN_WARNING "CIFS: server net" |
1215 | "biosname longer than 15 truncated.\n"); | 1218 | "biosname longer than 15 truncated.\n"); |
1216 | } | 1219 | } |
1220 | } else if (strnicmp(data, "actimeo", 7) == 0) { | ||
1221 | if (value && *value) { | ||
1222 | vol->actimeo = HZ * simple_strtoul(value, | ||
1223 | &value, 0); | ||
1224 | if (vol->actimeo > CIFS_MAX_ACTIMEO) { | ||
1225 | cERROR(1, "CIFS: attribute cache" | ||
1226 | "timeout too large"); | ||
1227 | return 1; | ||
1228 | } | ||
1229 | } | ||
1217 | } else if (strnicmp(data, "credentials", 4) == 0) { | 1230 | } else if (strnicmp(data, "credentials", 4) == 0) { |
1218 | /* ignore */ | 1231 | /* ignore */ |
1219 | } else if (strnicmp(data, "version", 3) == 0) { | 1232 | } else if (strnicmp(data, "version", 3) == 0) { |
@@ -2571,6 +2584,8 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info, | |||
2571 | cFYI(1, "file mode: 0x%x dir mode: 0x%x", | 2584 | cFYI(1, "file mode: 0x%x dir mode: 0x%x", |
2572 | cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); | 2585 | cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); |
2573 | 2586 | ||
2587 | cifs_sb->actimeo = pvolume_info->actimeo; | ||
2588 | |||
2574 | if (pvolume_info->noperm) | 2589 | if (pvolume_info->noperm) |
2575 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM; | 2590 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM; |
2576 | if (pvolume_info->setuids) | 2591 | if (pvolume_info->setuids) |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 28cb6e735943..bb5ca4848e81 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1653,6 +1653,7 @@ static bool | |||
1653 | cifs_inode_needs_reval(struct inode *inode) | 1653 | cifs_inode_needs_reval(struct inode *inode) |
1654 | { | 1654 | { |
1655 | struct cifsInodeInfo *cifs_i = CIFS_I(inode); | 1655 | struct cifsInodeInfo *cifs_i = CIFS_I(inode); |
1656 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | ||
1656 | 1657 | ||
1657 | if (cifs_i->clientCanCacheRead) | 1658 | if (cifs_i->clientCanCacheRead) |
1658 | return false; | 1659 | return false; |
@@ -1663,12 +1664,12 @@ cifs_inode_needs_reval(struct inode *inode) | |||
1663 | if (cifs_i->time == 0) | 1664 | if (cifs_i->time == 0) |
1664 | return true; | 1665 | return true; |
1665 | 1666 | ||
1666 | /* FIXME: the actimeo should be tunable */ | 1667 | if (!time_in_range(jiffies, cifs_i->time, |
1667 | if (time_after_eq(jiffies, cifs_i->time + HZ)) | 1668 | cifs_i->time + cifs_sb->actimeo)) |
1668 | return true; | 1669 | return true; |
1669 | 1670 | ||
1670 | /* hardlinked files w/ noserverino get "special" treatment */ | 1671 | /* hardlinked files w/ noserverino get "special" treatment */ |
1671 | if (!(CIFS_SB(inode->i_sb)->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) && | 1672 | if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) && |
1672 | S_ISREG(inode->i_mode) && inode->i_nlink != 1) | 1673 | S_ISREG(inode->i_mode) && inode->i_nlink != 1) |
1673 | return true; | 1674 | return true; |
1674 | 1675 | ||