cifs: potential missing check for posix_lock_file_wait
authorChengyu Song <csong84@gatech.edu>
Wed, 25 Mar 2015 00:18:49 +0000 (20:18 -0400)
committerSteve French <smfrench@gmail.com>
Wed, 20 May 2015 18:08:33 +0000 (13:08 -0500)
posix_lock_file_wait may fail under certain circumstances, and its result is
usually checked/returned. But given the complexity of cifs, I'm not sure if
the result is intentially left unchecked and always expected to succeed.

Signed-off-by: Chengyu Song <csong84@gatech.edu>
Acked-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Steve French <smfrench@gmail.com>
fs/cifs/file.c

index 5cfa712..3f50cee 100644 (file)
@@ -1552,8 +1552,8 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
                rc = server->ops->mand_unlock_range(cfile, flock, xid);
 
 out:
-       if (flock->fl_flags & FL_POSIX)
-               posix_lock_file_wait(file, flock);
+       if (flock->fl_flags & FL_POSIX && !rc)
+               rc = posix_lock_file_wait(file, flock);
        return rc;
 }