diff options
author | Joel Becker <joel.becker@oracle.com> | 2010-04-30 16:37:29 -0400 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-04-30 16:37:29 -0400 |
commit | f9221fd80343285514568da6c5dbda0f87109de8 (patch) | |
tree | 3a2f0077ebea9d094bdeedb319c97cb591d51c51 /fs/cifs/file.c | |
parent | a36d515c7a2dfacebcf41729f6812dbc424ebcf0 (diff) | |
parent | a9743fcdc0eb43d028b71267438076e1b0112ba0 (diff) |
Merge branch 'skip_delete_inode' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2-mark into ocfs2-fixes
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r-- | fs/cifs/file.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index ca2ba7a0193c..9b11a8f56f3a 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/task_io_accounting_ops.h> | 31 | #include <linux/task_io_accounting_ops.h> |
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/mount.h> | 33 | #include <linux/mount.h> |
34 | #include <linux/slab.h> | ||
34 | #include <asm/div64.h> | 35 | #include <asm/div64.h> |
35 | #include "cifsfs.h" | 36 | #include "cifsfs.h" |
36 | #include "cifspdu.h" | 37 | #include "cifspdu.h" |
@@ -838,8 +839,32 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
838 | 839 | ||
839 | } else { | 840 | } else { |
840 | /* if rc == ERR_SHARING_VIOLATION ? */ | 841 | /* if rc == ERR_SHARING_VIOLATION ? */ |
841 | rc = 0; /* do not change lock type to unlock | 842 | rc = 0; |
842 | since range in use */ | 843 | |
844 | if (lockType & LOCKING_ANDX_SHARED_LOCK) { | ||
845 | pfLock->fl_type = F_WRLCK; | ||
846 | } else { | ||
847 | rc = CIFSSMBLock(xid, tcon, netfid, length, | ||
848 | pfLock->fl_start, 0, 1, | ||
849 | lockType | LOCKING_ANDX_SHARED_LOCK, | ||
850 | 0 /* wait flag */); | ||
851 | if (rc == 0) { | ||
852 | rc = CIFSSMBLock(xid, tcon, netfid, | ||
853 | length, pfLock->fl_start, 1, 0, | ||
854 | lockType | | ||
855 | LOCKING_ANDX_SHARED_LOCK, | ||
856 | 0 /* wait flag */); | ||
857 | pfLock->fl_type = F_RDLCK; | ||
858 | if (rc != 0) | ||
859 | cERROR(1, ("Error unlocking " | ||
860 | "previously locked range %d " | ||
861 | "during test of lock", rc)); | ||
862 | rc = 0; | ||
863 | } else { | ||
864 | pfLock->fl_type = F_WRLCK; | ||
865 | rc = 0; | ||
866 | } | ||
867 | } | ||
843 | } | 868 | } |
844 | 869 | ||
845 | FreeXid(xid); | 870 | FreeXid(xid); |