Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 9977
b: refs/heads/master
c: 039c4d7
h: refs/heads/master
i:
  9975: 4f7179d
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Oct 18, 2005
1 parent f5ffe4c commit 63f05bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 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: 06735b3454824bd561decbde46111f144e905923
refs/heads/master: 039c4d7a82d8268ec71f59679460b41d0dd9b225
27 changes: 18 additions & 9 deletions trunk/fs/nfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,22 +376,31 @@ nfs_file_write(struct kiocb *iocb, const char __user *buf, size_t count, loff_t

static int do_getlk(struct file *filp, int cmd, struct file_lock *fl)
{
struct file_lock *cfl;
struct inode *inode = filp->f_mapping->host;
int status = 0;

lock_kernel();
/* Use local locking if mounted with "-onolock" */
if (!(NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM))
status = NFS_PROTO(inode)->lock(filp, cmd, fl);
else {
struct file_lock *cfl = posix_test_lock(filp, fl);

fl->fl_type = F_UNLCK;
if (cfl != NULL)
memcpy(fl, cfl, sizeof(*fl));
/* Try local locking first */
cfl = posix_test_lock(filp, fl);
if (cfl != NULL) {
locks_copy_lock(fl, cfl);
goto out;
}

if (nfs_have_delegation(inode, FMODE_READ))
goto out_noconflict;

if (NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM)
goto out_noconflict;

status = NFS_PROTO(inode)->lock(filp, cmd, fl);
out:
unlock_kernel();
return status;
out_noconflict:
fl->fl_type = F_UNLCK;
goto out;
}

static int do_vfs_lock(struct file *file, struct file_lock *fl)
Expand Down

0 comments on commit 63f05bc

Please sign in to comment.