Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cifs: remove the retry in cifs_poxis_lock_set

The caller of cifs_posix_lock_set will do retry(like
fcntl_setlk64->do_lock_file_wait) if we will wait for any file_lock.
So the retry in cifs_poxis_lock_set seems duplicated, remove it to
make a cleanup.

Signed-off-by: yangerkun <yangerkun@huawei.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: NeilBrown <neilb@suse.de>

authored by

yangerkun and committed by
Steve French
2e98c018 4ef9b4f1

+6 -13
+6 -13
fs/cifs/file.c
··· 1149 1149 1150 1150 /* 1151 1151 * Set the byte-range lock (posix style). Returns: 1152 - * 1) 0, if we set the lock and don't need to request to the server; 1153 - * 2) 1, if we need to request to the server; 1154 - * 3) <0, if the error occurs while setting the lock. 1152 + * 1) <0, if the error occurs while setting the lock; 1153 + * 2) 0, if we set the lock and don't need to request to the server; 1154 + * 3) FILE_LOCK_DEFERRED, if we will wait for some other file_lock; 1155 + * 4) FILE_LOCK_DEFERRED + 1, if we need to request to the server. 1155 1156 */ 1156 1157 static int 1157 1158 cifs_posix_lock_set(struct file *file, struct file_lock *flock) 1158 1159 { 1159 1160 struct cifsInodeInfo *cinode = CIFS_I(file_inode(file)); 1160 - int rc = 1; 1161 + int rc = FILE_LOCK_DEFERRED + 1; 1161 1162 1162 1163 if ((flock->fl_flags & FL_POSIX) == 0) 1163 1164 return rc; 1164 1165 1165 - try_again: 1166 1166 cifs_down_write(&cinode->lock_sem); 1167 1167 if (!cinode->can_cache_brlcks) { 1168 1168 up_write(&cinode->lock_sem); ··· 1171 1171 1172 1172 rc = posix_lock_file(file, flock, NULL); 1173 1173 up_write(&cinode->lock_sem); 1174 - if (rc == FILE_LOCK_DEFERRED) { 1175 - rc = wait_event_interruptible(flock->fl_wait, 1176 - list_empty(&flock->fl_blocked_member)); 1177 - if (!rc) 1178 - goto try_again; 1179 - locks_delete_block(flock); 1180 - } 1181 1174 return rc; 1182 1175 } 1183 1176 ··· 1645 1652 int posix_lock_type; 1646 1653 1647 1654 rc = cifs_posix_lock_set(file, flock); 1648 - if (!rc || rc < 0) 1655 + if (rc <= FILE_LOCK_DEFERRED) 1649 1656 return rc; 1650 1657 1651 1658 if (type & server->vals->shared_lock_type)