aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorPavel Shilovsky <piastry@etersoft.ru>2012-11-22 08:00:10 -0500
committerSteve French <smfrench@gmail.com>2012-12-05 14:27:29 -0500
commit9ec3c882879d3777914d34c0143c7d5b87dbb5ea (patch)
tree97a8b4e85e85021152a2d9fcd5310b5ac23c2842 /fs/cifs
parent6d3ea7e4975aed451fbee4dea2fef63b0de8cb4f (diff)
CIFS: Separate pushing posix locks and lock_sem handling
Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/file.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 70b6f4c3a0c1..5fbbf99e61f9 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1041,9 +1041,8 @@ struct lock_to_push {
1041}; 1041};
1042 1042
1043static int 1043static int
1044cifs_push_posix_locks(struct cifsFileInfo *cfile) 1044cifs_push_posix_locks_locked(struct cifsFileInfo *cfile)
1045{ 1045{
1046 struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode);
1047 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 1046 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
1048 struct file_lock *flock, **before; 1047 struct file_lock *flock, **before;
1049 unsigned int count = 0, i = 0; 1048 unsigned int count = 0, i = 0;
@@ -1054,14 +1053,6 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
1054 1053
1055 xid = get_xid(); 1054 xid = get_xid();
1056 1055
1057 /* we are going to update can_cache_brlcks here - need a write access */
1058 down_write(&cinode->lock_sem);
1059 if (!cinode->can_cache_brlcks) {
1060 up_write(&cinode->lock_sem);
1061 free_xid(xid);
1062 return rc;
1063 }
1064
1065 lock_flocks(); 1056 lock_flocks();
1066 cifs_for_each_lock(cfile->dentry->d_inode, before) { 1057 cifs_for_each_lock(cfile->dentry->d_inode, before) {
1067 if ((*before)->fl_flags & FL_POSIX) 1058 if ((*before)->fl_flags & FL_POSIX)
@@ -1127,9 +1118,6 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
1127 } 1118 }
1128 1119
1129out: 1120out:
1130 cinode->can_cache_brlcks = false;
1131 up_write(&cinode->lock_sem);
1132
1133 free_xid(xid); 1121 free_xid(xid);
1134 return rc; 1122 return rc;
1135err_out: 1123err_out:
@@ -1141,6 +1129,24 @@ err_out:
1141} 1129}
1142 1130
1143static int 1131static int
1132cifs_push_posix_locks(struct cifsFileInfo *cfile)
1133{
1134 struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode);
1135 int rc = 0;
1136
1137 /* we are going to update can_cache_brlcks here - need a write access */
1138 down_write(&cinode->lock_sem);
1139 if (!cinode->can_cache_brlcks) {
1140 up_write(&cinode->lock_sem);
1141 return rc;
1142 }
1143 rc = cifs_push_posix_locks_locked(cfile);
1144 cinode->can_cache_brlcks = false;
1145 up_write(&cinode->lock_sem);
1146 return rc;
1147}
1148
1149static int
1144cifs_push_locks(struct cifsFileInfo *cfile) 1150cifs_push_locks(struct cifsFileInfo *cfile)
1145{ 1151{
1146 struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb); 1152 struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb);