Skip to content

Commit 4316c3c

Browse files
NeilBrownjtlayton
authored andcommitted
ocfs2: properly initial file_lock used for unlock.
Rather than assuming all-zeros is sufficient, use the available API to initialize the file_lock structure use for unlock. VFS-level changes will soon make it important that the list_heads in file_lock are always properly initialized. Signed-off-by: NeilBrown <[email protected]> Reviewed-by: J. Bruce Fields <[email protected]> Signed-off-by: Jeff Layton <[email protected]>
1 parent 4d62d3f commit 4316c3c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fs/ocfs2/locks.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode,
5252
if (lockres->l_flags & OCFS2_LOCK_ATTACHED &&
5353
lockres->l_level > LKM_NLMODE) {
5454
int old_level = 0;
55+
struct file_lock request;
5556

5657
if (lockres->l_level == LKM_EXMODE)
5758
old_level = 1;
@@ -66,11 +67,10 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode,
6667
* level.
6768
*/
6869

69-
locks_lock_file_wait(file,
70-
&(struct file_lock) {
71-
.fl_type = F_UNLCK,
72-
.fl_flags = FL_FLOCK
73-
});
70+
locks_init_lock(&request);
71+
request.fl_type = F_UNLCK;
72+
request.fl_flags = FL_FLOCK;
73+
locks_lock_file_wait(file, &request);
7474

7575
ocfs2_file_unlock(file);
7676
}

0 commit comments

Comments
 (0)