From b13c7fbb3ab712a9fb78c613ef34ed69b88e00ca Mon Sep 17 00:00:00 2001 From: Pavel Shilovsky Date: Thu, 22 Nov 2012 17:00:10 +0400 Subject: [PATCH] --- yaml --- r: 339463 b: refs/heads/master c: 9ec3c882879d3777914d34c0143c7d5b87dbb5ea h: refs/heads/master i: 339461: c230c755938e7957782cabb6dc1a8fc5ec916430 339459: d78b6ff86aea39fa46953a3b967d96436ff13548 339455: 05e8cd9412bdb85ffd57ff78a13899194f70a65e v: v3 --- [refs] | 2 +- trunk/fs/cifs/file.c | 32 +++++++++++++++++++------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/[refs] b/[refs] index 15c12953e4f1..71b30a335a9f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6d3ea7e4975aed451fbee4dea2fef63b0de8cb4f +refs/heads/master: 9ec3c882879d3777914d34c0143c7d5b87dbb5ea diff --git a/trunk/fs/cifs/file.c b/trunk/fs/cifs/file.c index 70b6f4c3a0c1..5fbbf99e61f9 100644 --- a/trunk/fs/cifs/file.c +++ b/trunk/fs/cifs/file.c @@ -1041,9 +1041,8 @@ struct lock_to_push { }; static int -cifs_push_posix_locks(struct cifsFileInfo *cfile) +cifs_push_posix_locks_locked(struct cifsFileInfo *cfile) { - struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); struct file_lock *flock, **before; unsigned int count = 0, i = 0; @@ -1054,14 +1053,6 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) xid = get_xid(); - /* we are going to update can_cache_brlcks here - need a write access */ - down_write(&cinode->lock_sem); - if (!cinode->can_cache_brlcks) { - up_write(&cinode->lock_sem); - free_xid(xid); - return rc; - } - lock_flocks(); cifs_for_each_lock(cfile->dentry->d_inode, before) { if ((*before)->fl_flags & FL_POSIX) @@ -1127,9 +1118,6 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) } out: - cinode->can_cache_brlcks = false; - up_write(&cinode->lock_sem); - free_xid(xid); return rc; err_out: @@ -1140,6 +1128,24 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) goto out; } +static int +cifs_push_posix_locks(struct cifsFileInfo *cfile) +{ + struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); + int rc = 0; + + /* we are going to update can_cache_brlcks here - need a write access */ + down_write(&cinode->lock_sem); + if (!cinode->can_cache_brlcks) { + up_write(&cinode->lock_sem); + return rc; + } + rc = cifs_push_posix_locks_locked(cfile); + cinode->can_cache_brlcks = false; + up_write(&cinode->lock_sem); + return rc; +} + static int cifs_push_locks(struct cifsFileInfo *cfile) {