@@ -9,6 +9,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include <linux/sched.h>
#include <linux/file.h>
@@ -9,6 +9,7 @@
#include <linux/kernel.h>
#include <linux/ktime.h>
#include <linux/fs.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include <linux/pagemap.h>
#include <linux/rxrpc.h>
@@ -7,6 +7,7 @@
#include "super.h"
#include "mds_client.h"
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include <linux/ceph/pagelist.h>
@@ -4,6 +4,7 @@
*/
#include <linux/fs.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include <linux/miscdevice.h>
#include <linux/poll.h>
@@ -15,6 +15,7 @@
#include <linux/mm.h>
#include <linux/mount.h>
#include <linux/fs.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include <linux/gfs2_ondisk.h>
#include <linux/falloc.h>
@@ -12,6 +12,7 @@
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include <linux/nfs_fs.h>
#include <linux/utsname.h>
@@ -48,6 +48,7 @@
* children.
*
*/
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/capability.h>
#include <linux/file.h>
@@ -31,6 +31,7 @@
#include <linux/swap.h>
#include <linux/uaccess.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include "delegation.h"
@@ -23,6 +23,7 @@
#define NFS4_MAX_LOOP_ON_RECOVER (10)
#include <linux/seqlock.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
struct idmap;
@@ -25,6 +25,7 @@
#include <linux/freezer.h>
#include <linux/wait.h>
#include <linux/iversion.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include <linux/uaccess.h>
@@ -10,6 +10,7 @@
#include <net/net_namespace.h>
#include <net/netns/generic.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include <linux/percpu_counter.h>
#include <linux/siphash.h>
@@ -8,6 +8,7 @@
*/
#include <linux/fs.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include <linux/fcntl.h>
@@ -9,6 +9,7 @@
#include <linux/module.h>
#include <linux/fs.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include <linux/miscdevice.h>
#include <linux/mutex.h>
@@ -1364,7 +1364,7 @@ struct file *filp_open(const char *filename, int flags, umode_t mode)
{
struct filename *name = getname_kernel(filename);
struct file *file = ERR_CAST(name);
-
+
if (!IS_ERR(name)) {
file = file_open_name(name, flags, mode);
putname(name);
@@ -786,12 +786,12 @@ struct posix_acl *posix_acl_from_xattr(struct user_namespace *userns,
return ERR_PTR(count);
if (count == 0)
return NULL;
-
+
acl = posix_acl_alloc(count, GFP_NOFS);
if (!acl)
return ERR_PTR(-ENOMEM);
acl_e = acl->a_entries;
-
+
for (end = entry + count; entry != end; acl_e++, entry++) {
acl_e->e_tag = le16_to_cpu(entry->e_tag);
acl_e->e_perm = le16_to_cpu(entry->e_perm);
@@ -26,6 +26,7 @@
#include <uapi/linux/cifs/cifs_mount.h>
#include "../common/smb2pdu.h"
#include "smb2pdu.h"
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#define SMB_PATH_MAX 260
@@ -15,6 +15,7 @@
/* want to reuse a stale file handle and only the caller knows the file info */
#include <linux/fs.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include <linux/kernel.h>
#include <linux/vfs.h>
@@ -9,6 +9,7 @@
*
*/
#include <linux/fs.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include <linux/backing-dev.h>
#include <linux/stat.h>
@@ -2951,7 +2952,7 @@ static int cifs_writepages_region(struct address_space *mapping,
continue;
}
- folio_batch_release(&fbatch);
+ folio_batch_release(&fbatch);
cond_resched();
} while (wbc->nr_to_write > 0);
@@ -7,6 +7,7 @@
*
*/
#include <linux/fs.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include <linux/stat.h>
#include <linux/slab.h>
@@ -12,6 +12,7 @@
#include <linux/ethtool.h>
#include <linux/falloc.h>
#include <linux/mount.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include "glob.h"
@@ -6,6 +6,7 @@
#include <linux/kernel.h>
#include <linux/fs.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include <linux/uaccess.h>
#include <linux/backing-dev.h>
@@ -85,23 +85,44 @@ bool opens_in_grace(struct net *);
*
* Obviously, the last two criteria only matter for POSIX locks.
*/
-struct file_lock {
- struct file_lock *fl_blocker; /* The lock, that is blocking us */
- struct list_head fl_list; /* link into file_lock_context */
- struct hlist_node fl_link; /* node in global lists */
- struct list_head fl_blocked_requests; /* list of requests with
+
+struct file_lock_core {
+ struct file_lock *flc_blocker; /* The lock that is blocking us */
+ struct list_head flc_list; /* link into file_lock_context */
+ struct hlist_node flc_link; /* node in global lists */
+ struct list_head flc_blocked_requests; /* list of requests with
* ->fl_blocker pointing here
*/
- struct list_head fl_blocked_member; /* node in
+ struct list_head flc_blocked_member; /* node in
* ->fl_blocker->fl_blocked_requests
*/
- fl_owner_t fl_owner;
- unsigned int fl_flags;
- unsigned char fl_type;
- unsigned int fl_pid;
- int fl_link_cpu; /* what cpu's list is this on? */
- wait_queue_head_t fl_wait;
- struct file *fl_file;
+ fl_owner_t flc_owner;
+ unsigned int flc_flags;
+ unsigned char flc_type;
+ unsigned int flc_pid;
+ int flc_link_cpu; /* what cpu's list is this on? */
+ wait_queue_head_t flc_wait;
+ struct file *flc_file;
+};
+
+/* Temporary macros to allow building during coccinelle conversion */
+#ifdef _NEED_FILE_LOCK_FIELD_MACROS
+#define fl_list fl_core.flc_list
+#define fl_blocker fl_core.flc_blocker
+#define fl_link fl_core.flc_link
+#define fl_blocked_requests fl_core.flc_blocked_requests
+#define fl_blocked_member fl_core.flc_blocked_member
+#define fl_owner fl_core.flc_owner
+#define fl_flags fl_core.flc_flags
+#define fl_type fl_core.flc_type
+#define fl_pid fl_core.flc_pid
+#define fl_link_cpu fl_core.flc_link_cpu
+#define fl_wait fl_core.flc_wait
+#define fl_file fl_core.flc_file
+#endif
+
+struct file_lock {
+ struct file_lock_core fl_core;
loff_t fl_start;
loff_t fl_end;
@@ -11,6 +11,7 @@
#define LOCKD_XDR_H
#include <linux/fs.h>
+#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h>
#include <linux/nfs.h>
#include <linux/sunrpc/xdr.h>
@@ -52,7 +53,7 @@ struct nlm_lock {
* FreeBSD uses 16, Apple Mac OS X 10.3 uses 20. Therefore we set it to
* 32 bytes.
*/
-
+
struct nlm_cookie
{
unsigned char data[NLM_MAXCOOKIELEN];
In a future patch, we're going to split file leases into their own structure. Since a lot of the underlying machinery uses the same fields move those into a new file_lock_core, and embed that inside struct file_lock. For now, add some macros to ensure that we can continue to build while the conversion is in progress. Signed-off-by: Jeff Layton <jlayton@kernel.org> --- fs/9p/vfs_file.c | 1 + fs/afs/internal.h | 1 + fs/ceph/locks.c | 1 + fs/dlm/plock.c | 1 + fs/gfs2/file.c | 1 + fs/lockd/clntproc.c | 1 + fs/locks.c | 1 + fs/nfs/file.c | 1 + fs/nfs/nfs4_fs.h | 1 + fs/nfs/write.c | 1 + fs/nfsd/netns.h | 1 + fs/ocfs2/locks.c | 1 + fs/ocfs2/stack_user.c | 1 + fs/open.c | 2 +- fs/posix_acl.c | 4 ++-- fs/smb/client/cifsglob.h | 1 + fs/smb/client/cifssmb.c | 1 + fs/smb/client/file.c | 3 ++- fs/smb/client/smb2file.c | 1 + fs/smb/server/smb2pdu.c | 1 + fs/smb/server/vfs.c | 1 + include/linux/filelock.h | 47 ++++++++++++++++++++++++++++++++++------------- include/linux/lockd/xdr.h | 3 ++- 23 files changed, 59 insertions(+), 18 deletions(-)