.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* -*- mode: c; c-basic-offset: 8; -*- |
---|
2 | 3 | * vim: noexpandtab sw=8 ts=8 sts=0: |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * Userspace file locking support |
---|
7 | 8 | * |
---|
8 | 9 | * Copyright (C) 2007 Oracle. All rights reserved. |
---|
9 | | - * |
---|
10 | | - * This program is free software; you can redistribute it and/or |
---|
11 | | - * modify it under the terms of the GNU General Public |
---|
12 | | - * License as published by the Free Software Foundation; either |
---|
13 | | - * version 2 of the License, or (at your option) any later version. |
---|
14 | | - * |
---|
15 | | - * This program is distributed in the hope that it will be useful, |
---|
16 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
18 | | - * General Public License for more details. |
---|
19 | | - * |
---|
20 | | - * You should have received a copy of the GNU General Public |
---|
21 | | - * License along with this program; if not, write to the |
---|
22 | | - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
23 | | - * Boston, MA 021110-1307, USA. |
---|
24 | 10 | */ |
---|
25 | 11 | |
---|
26 | 12 | #include <linux/fs.h> |
---|
.. | .. |
---|
52 | 38 | if (lockres->l_flags & OCFS2_LOCK_ATTACHED && |
---|
53 | 39 | lockres->l_level > LKM_NLMODE) { |
---|
54 | 40 | int old_level = 0; |
---|
| 41 | + struct file_lock request; |
---|
55 | 42 | |
---|
56 | 43 | if (lockres->l_level == LKM_EXMODE) |
---|
57 | 44 | old_level = 1; |
---|
.. | .. |
---|
66 | 53 | * level. |
---|
67 | 54 | */ |
---|
68 | 55 | |
---|
69 | | - locks_lock_file_wait(file, |
---|
70 | | - &(struct file_lock) { |
---|
71 | | - .fl_type = F_UNLCK, |
---|
72 | | - .fl_flags = FL_FLOCK |
---|
73 | | - }); |
---|
| 56 | + locks_init_lock(&request); |
---|
| 57 | + request.fl_type = F_UNLCK; |
---|
| 58 | + request.fl_flags = FL_FLOCK; |
---|
| 59 | + locks_lock_file_wait(file, &request); |
---|
74 | 60 | |
---|
75 | 61 | ocfs2_file_unlock(file); |
---|
76 | 62 | } |
---|