提交 ce85852b 编写于 作者: P Pavel Shilovsky 提交者: Steve French

CIFS: Fix a spurious error in cifs_push_posix_locks

Signed-off-by: NPavel Shilovsky <piastry@etersoft.ru>
Reviewed-by: NJeff Layton <jlayton@redhat.com>
Reported-by: NBen Hutchings <ben@decadent.org.uk>
Signed-off-by: NSteve French <stevef@smf-gateway.(none)>
上级 c16fa4f2
...@@ -960,9 +960,9 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) ...@@ -960,9 +960,9 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
INIT_LIST_HEAD(&locks_to_send); INIT_LIST_HEAD(&locks_to_send);
/* /*
* Allocating count locks is enough because no locks can be added to * Allocating count locks is enough because no FL_POSIX locks can be
* the list while we are holding cinode->lock_mutex that protects * added to the list while we are holding cinode->lock_mutex that
* locking operations of this inode. * protects locking operations of this inode.
*/ */
for (; i < count; i++) { for (; i < count; i++) {
lck = kmalloc(sizeof(struct lock_to_push), GFP_KERNEL); lck = kmalloc(sizeof(struct lock_to_push), GFP_KERNEL);
...@@ -973,18 +973,20 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) ...@@ -973,18 +973,20 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
list_add_tail(&lck->llist, &locks_to_send); list_add_tail(&lck->llist, &locks_to_send);
} }
i = 0;
el = locks_to_send.next; el = locks_to_send.next;
lock_flocks(); lock_flocks();
cifs_for_each_lock(cfile->dentry->d_inode, before) { cifs_for_each_lock(cfile->dentry->d_inode, before) {
flock = *before;
if ((flock->fl_flags & FL_POSIX) == 0)
continue;
if (el == &locks_to_send) { if (el == &locks_to_send) {
/* something is really wrong */ /*
* The list ended. We don't have enough allocated
* structures - something is really wrong.
*/
cERROR(1, "Can't push all brlocks!"); cERROR(1, "Can't push all brlocks!");
break; break;
} }
flock = *before;
if ((flock->fl_flags & FL_POSIX) == 0)
continue;
length = 1 + flock->fl_end - flock->fl_start; length = 1 + flock->fl_end - flock->fl_start;
if (flock->fl_type == F_RDLCK || flock->fl_type == F_SHLCK) if (flock->fl_type == F_RDLCK || flock->fl_type == F_SHLCK)
type = CIFS_RDLCK; type = CIFS_RDLCK;
...@@ -996,7 +998,6 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) ...@@ -996,7 +998,6 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
lck->length = length; lck->length = length;
lck->type = type; lck->type = type;
lck->offset = flock->fl_start; lck->offset = flock->fl_start;
i++;
el = el->next; el = el->next;
} }
unlock_flocks(); unlock_flocks();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册