Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 217087
b: refs/heads/master
c: 6b96724
h: refs/heads/master
i:
  217085: 2e82887
  217083: bad960c
  217079: b924f18
  217071: 95ef4f9
  217055: ac60699
  217023: 72f3656
  216959: e5bc886
  216831: 7516913
  216575: c6c1946
  216063: 66acf48
  215039: 452be46
  212991: 0c478d4
v: v3
  • Loading branch information
Ricardo Labiaga authored and Trond Myklebust committed Oct 24, 2010
1 parent daf4208 commit 3db2d0f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 118df3d17f11733b294ea2cd988d56ee376ef9fd
refs/heads/master: 6b96724e507fecc3e6440e86426fe4f44359ed66
2 changes: 2 additions & 0 deletions trunk/fs/nfs/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,8 @@ static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fsinfo *

server->maxfilesize = fsinfo->maxfilesize;

server->time_delta = fsinfo->time_delta;

/* We're airborne Set socket buffersize */
rpc_setbufsize(server->client, server->wsize + 100, server->rsize + 100);
}
Expand Down
19 changes: 16 additions & 3 deletions trunk/fs/nfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,11 @@ do_unlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
return status;
}

static int
is_time_granular(struct timespec *ts) {
return ((ts->tv_sec == 0) && (ts->tv_nsec <= 1000));
}

static int
do_setlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
{
Expand All @@ -781,13 +786,21 @@ do_setlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
status = do_vfs_lock(filp, fl);
if (status < 0)
goto out;

/*
* Make sure we clear the cache whenever we try to get the lock.
* Revalidate the cache if the server has time stamps granular
* enough to detect subsecond changes. Otherwise, clear the
* cache to prevent missing any changes.
*
* This makes locking act as a cache coherency point.
*/
nfs_sync_mapping(filp->f_mapping);
if (!nfs_have_delegation(inode, FMODE_READ))
nfs_zap_caches(inode);
if (!nfs_have_delegation(inode, FMODE_READ)) {
if (is_time_granular(&NFS_SERVER(inode)->time_delta))
__nfs_revalidate_inode(NFS_SERVER(inode), inode);
else
nfs_zap_caches(inode);
}
out:
return status;
}
Expand Down
3 changes: 2 additions & 1 deletion trunk/fs/nfs/nfs3xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1044,8 +1044,9 @@ nfs3_xdr_fsinfores(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *res)
res->wtmult = ntohl(*p++);
res->dtpref = ntohl(*p++);
p = xdr_decode_hyper(p, &res->maxfilesize);
p = xdr_decode_time3(p, &res->time_delta);

/* ignore time_delta and properties */
/* ignore properties */
res->lease_time = 0;
return 0;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/nfs_fs_sb.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ struct nfs_server {

struct nfs_fsid fsid;
__u64 maxfilesize; /* maximum file size */
struct timespec time_delta; /* smallest time granularity */
unsigned long mount_time; /* when this fs was mounted */
dev_t s_dev; /* superblock dev numbers */

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/nfs_xdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ struct nfs_fsinfo {
__u32 wtmult; /* writes should be multiple of this */
__u32 dtpref; /* pref. readdir transfer size */
__u64 maxfilesize;
struct timespec time_delta; /* server time granularity */
__u32 lease_time; /* in seconds */
};

Expand Down

0 comments on commit 3db2d0f

Please sign in to comment.