[packages/kernel] - rel 1; aufs5 updated

arekm arekm at pld-linux.org
Tue Dec 15 15:38:26 CET 2020


commit e37dd06aa8802a64332fe12279c3923ddd77794d
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Tue Dec 15 15:38:15 2020 +0100

    - rel 1; aufs5 updated

 kernel-aufs5.patch | 379 ++++++++++++++---------------------------------------
 kernel.spec        |   2 +-
 2 files changed, 99 insertions(+), 282 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index 486cee1e..d20e4ca1 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -71,7 +71,7 @@
 %define		have_pcmcia	0
 %endif
 
-%define		rel		0.1
+%define		rel		1
 %define		basever		5.10
 %define		postver		.0
 
diff --git a/kernel-aufs5.patch b/kernel-aufs5.patch
index 817d2bc1..33c119f2 100644
--- a/kernel-aufs5.patch
+++ b/kernel-aufs5.patch
@@ -143,39 +143,6 @@ index a28e4db075ede..12e725e34c6ca 100644
  /*
   * vfsmount lock must be held for write
   */
-diff --git a/fs/read_write.c b/fs/read_write.c
-index bbfa9b12b15eb..5d684d7d29207 100644
---- a/fs/read_write.c
-+++ b/fs/read_write.c
-@@ -499,6 +499,28 @@ static ssize_t __vfs_write(struct file *file, const char __user *p,
- 	return ret;
- }
- 
-+vfs_readf_t vfs_readf(struct file *file)
-+{
-+	const struct file_operations *fop = file->f_op;
-+
-+	if (fop->read)
-+		return fop->read;
-+	if (fop->read_iter)
-+		return new_sync_read;
-+	return ERR_PTR(-ENOSYS); /* doesn't have ->read(|_iter)() op */
-+}
-+
-+vfs_writef_t vfs_writef(struct file *file)
-+{
-+	const struct file_operations *fop = file->f_op;
-+
-+	if (fop->write)
-+		return fop->write;
-+	if (fop->write_iter)
-+		return new_sync_write;
-+	return ERR_PTR(-ENOSYS); /* doesn't have ->write(|_iter)() op */
-+}
-+
- /* caller is responsible for file_start_write/file_end_write */
- ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t *pos)
- {
 diff --git a/fs/splice.c b/fs/splice.c
 index 4e53efbd621db..9f230ee854e20 100644
 --- a/fs/splice.c
@@ -221,7 +188,7 @@ diff --git a/include/linux/fs.h b/include/linux/fs.h
 index 45cc10cdf6ddd..916efd7e612b3 100644
 --- a/include/linux/fs.h
 +++ b/include/linux/fs.h
-@@ -1355,6 +1355,7 @@ extern void fasync_free(struct fasync_struct *);
+@@ -1370,6 +1370,7 @@
  /* can be called from interrupts */
  extern void kill_fasync(struct fasync_struct **, int, int);
  
@@ -229,7 +196,7 @@ index 45cc10cdf6ddd..916efd7e612b3 100644
  extern void __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
  extern int f_setown(struct file *filp, unsigned long arg, int force);
  extern void f_delown(struct file *filp);
-@@ -1847,6 +1848,7 @@ struct file_operations {
+@@ -1858,6 +1859,7 @@
  	ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
  	unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
  	int (*check_flags)(int);
@@ -237,20 +204,7 @@ index 45cc10cdf6ddd..916efd7e612b3 100644
  	int (*flock) (struct file *, int, struct file_lock *);
  	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
  	ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
-@@ -1917,6 +1919,12 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
- 			      struct iovec *fast_pointer,
- 			      struct iovec **ret_pointer);
- 
-+typedef ssize_t (*vfs_readf_t)(struct file *, char __user *, size_t, loff_t *);
-+typedef ssize_t (*vfs_writef_t)(struct file *, const char __user *, size_t,
-+				loff_t *);
-+vfs_readf_t vfs_readf(struct file *file);
-+vfs_writef_t vfs_writef(struct file *file);
-+
- extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
- extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);
- extern ssize_t vfs_readv(struct file *, const struct iovec __user *,
-@@ -2349,6 +2357,7 @@ extern int current_umask(void);
+@@ -2362,6 +2370,7 @@
  extern void ihold(struct inode * inode);
  extern void iput(struct inode *);
  extern int generic_update_time(struct inode *, struct timespec64 *, int);
@@ -258,7 +212,7 @@ index 45cc10cdf6ddd..916efd7e612b3 100644
  
  /* /sys/fs */
  extern struct kobject *fs_kobj;
-@@ -2633,6 +2642,7 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb)
+@@ -2549,6 +2558,7 @@
  }
  
  void emergency_thaw_all(void);
@@ -291,7 +245,7 @@ diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
 index 35942084cd40d..24f5fd1a789de 100644
 --- a/include/linux/mnt_namespace.h
 +++ b/include/linux/mnt_namespace.h
-@@ -6,12 +6,15 @@
+@@ -7,12 +7,15 @@
  struct fs_struct;
  struct user_namespace;
  struct ns_common;
@@ -884,22 +838,6 @@ index 5d684d7d29207..6f61c0b6aa664 100644
  
  static ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos)
  {
-@@ -509,6 +510,7 @@ vfs_readf_t vfs_readf(struct file *file)
- 		return new_sync_read;
- 	return ERR_PTR(-ENOSYS); /* doesn't have ->read(|_iter)() op */
- }
-+EXPORT_SYMBOL_GPL(vfs_readf);
- 
- vfs_writef_t vfs_writef(struct file *file)
- {
-@@ -520,6 +522,7 @@ vfs_writef_t vfs_writef(struct file *file)
- 		return new_sync_write;
- 	return ERR_PTR(-ENOSYS); /* doesn't have ->write(|_iter)() op */
- }
-+EXPORT_SYMBOL_GPL(vfs_writef);
- 
- ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t *pos)
- {
 @@ -589,6 +592,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
  
  	return ret;
@@ -4438,8 +4376,8 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +}
 diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 --- /usr/share/empty/fs/aufs/branch.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/branch.h	2020-01-27 10:57:18.165538015 +0100
-@@ -0,0 +1,366 @@
++++ linux/fs/aufs/branch.h	2020-12-15 14:10:58.911356294 +0100
+@@ -0,0 +1,364 @@
 +/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2020 Junjiro R. Okajima
@@ -4683,10 +4621,8 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +		 ino_t *ino);
 +int au_xino_write(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
 +		  ino_t ino);
-+ssize_t xino_fread(vfs_readf_t func, struct file *file, void *buf, size_t size,
-+		   loff_t *pos);
-+ssize_t xino_fwrite(vfs_writef_t func, struct file *file, void *buf,
-+		    size_t size, loff_t *pos);
++ssize_t xino_fread(struct file *file, void *buf, size_t size, loff_t *pos);
++ssize_t xino_fwrite(struct file *file, void *buf, size_t size, loff_t *pos);
 +
 +int au_xib_trunc(struct super_block *sb);
 +int au_xino_trunc(struct super_block *sb, aufs_bindex_t bindex, int idx_begin);
@@ -4852,8 +4788,8 @@ diff -urN /usr/share/empty/fs/aufs/conf.mk linux/fs/aufs/conf.mk
 +-include ${srctree}/${src}/conf_priv.mk
 diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 --- /usr/share/empty/fs/aufs/cpup.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/cpup.c	2020-01-27 10:57:18.165538015 +0100
-@@ -0,0 +1,1458 @@
++++ linux/fs/aufs/cpup.c	2020-12-15 14:10:58.911356294 +0100
+@@ -0,0 +1,1445 @@
 +// SPDX-License-Identifier: GPL-2.0
 +/*
 + * Copyright (C) 2005-2020 Junjiro R. Okajima
@@ -5425,32 +5361,19 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +static int au_do_cpup_symlink(struct path *h_path, struct dentry *h_src,
 +			      struct inode *h_dir)
 +{
-+	int err, symlen;
-+	mm_segment_t old_fs;
-+	union {
-+		char *k;
-+		char __user *u;
-+	} sym;
++	int err;
++	DEFINE_DELAYED_CALL(done);
++	const char *sym;
 +
-+	err = -ENOMEM;
-+	sym.k = (void *)__get_free_page(GFP_NOFS);
-+	if (unlikely(!sym.k))
++	sym = vfs_get_link(h_src, &done);
++	err = PTR_ERR(sym);
++	if (IS_ERR(sym))
 +		goto out;
 +
-+	/* unnecessary to support mmap_sem since symlink is not mmap-able */
-+	old_fs = get_fs();
-+	set_fs(KERNEL_DS);
-+	symlen = vfs_readlink(h_src, sym.u, PATH_MAX);
-+	err = symlen;
-+	set_fs(old_fs);
-+
-+	if (symlen > 0) {
-+		sym.k[symlen] = 0;
-+		err = vfsub_symlink(h_dir, h_path, sym.k);
-+	}
-+	free_page((unsigned long)sym.k);
++	err = vfsub_symlink(h_dir, h_path, sym);
 +
 +out:
++	do_delayed_call(&done);
 +	return err;
 +}
 +
@@ -12407,8 +12330,8 @@ diff -urN /usr/share/empty/fs/aufs/dirren.h linux/fs/aufs/dirren.h
 +#endif /* __AUFS_DIRREN_H__ */
 diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 --- /usr/share/empty/fs/aufs/dynop.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dynop.c	2020-01-27 10:57:18.168871450 +0100
-@@ -0,0 +1,367 @@
++++ linux/fs/aufs/dynop.c	2020-12-15 14:10:58.914689728 +0100
+@@ -0,0 +1,368 @@
 +// SPDX-License-Identifier: GPL-2.0
 +/*
 + * Copyright (C) 2010-2020 Junjiro R. Okajima
@@ -12591,6 +12514,7 @@ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 +	DySetAop(writepages);
 +	DySetAop(set_page_dirty);
 +	DySetAop(readpages);
++	DySetAop(readahead);
 +	DySetAop(write_begin);
 +	DySetAop(write_end);
 +	DySetAop(bmap);
@@ -12859,8 +12783,8 @@ diff -urN /usr/share/empty/fs/aufs/dynop.h linux/fs/aufs/dynop.h
 +#endif /* __AUFS_DYNOP_H__ */
 diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 --- /usr/share/empty/fs/aufs/export.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/export.c	2020-01-27 10:57:18.168871450 +0100
-@@ -0,0 +1,838 @@
++++ linux/fs/aufs/export.c	2020-12-15 14:10:58.914689728 +0100
+@@ -0,0 +1,837 @@
 +// SPDX-License-Identifier: GPL-2.0
 +/*
 + * Copyright (C) 2005-2020 Junjiro R. Okajima
@@ -12984,8 +12908,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +	pos = inode->i_ino;
 +	pos *= sizeof(igen);
 +	igen = inode->i_generation + 1;
-+	sz = xino_fwrite(sbinfo->si_xwrite, sbinfo->si_xigen, &igen,
-+			 sizeof(igen), &pos);
++	sz = xino_fwrite(sbinfo->si_xigen, &igen, sizeof(igen), &pos);
 +	if (sz == sizeof(igen))
 +		return; /* success */
 +
@@ -13027,10 +12950,10 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +	if (vfsub_f_size_read(file)
 +	    < pos + sizeof(inode->i_generation)) {
 +		inode->i_generation = atomic_inc_return(&sbinfo->si_xigen_next);
-+		sz = xino_fwrite(sbinfo->si_xwrite, file, &inode->i_generation,
++		sz = xino_fwrite(file, &inode->i_generation,
 +				 sizeof(inode->i_generation), &pos);
 +	} else
-+		sz = xino_fread(sbinfo->si_xread, file, &inode->i_generation,
++		sz = xino_fread(file, &inode->i_generation,
 +				sizeof(inode->i_generation), &pos);
 +	if (sz == sizeof(inode->i_generation))
 +		goto out; /* success */
@@ -14132,8 +14055,8 @@ diff -urN /usr/share/empty/fs/aufs/fhsm.c linux/fs/aufs/fhsm.c
 +}
 diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 --- /usr/share/empty/fs/aufs/file.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/file.c	2020-01-27 10:57:18.172204883 +0100
-@@ -0,0 +1,863 @@
++++ linux/fs/aufs/file.c	2020-12-15 14:10:58.918023162 +0100
+@@ -0,0 +1,867 @@
 +// SPDX-License-Identifier: GPL-2.0
 +/*
 + * Copyright (C) 2005-2020 Junjiro R. Okajima
@@ -14926,6 +14849,10 @@ diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 +
 +/* they will never be called. */
 +#ifdef CONFIG_AUFS_DEBUG
++/*
++void aufs_readahead(struct readahead_control *)
++{ AuUnsupport(); }
++*/
 +static int aufs_write_begin(struct file *file, struct address_space *mapping,
 +			    loff_t pos, unsigned len, unsigned flags,
 +			    struct page **pagep, void **fsdata)
@@ -15498,8 +15425,8 @@ diff -urN /usr/share/empty/fs/aufs/finfo.c linux/fs/aufs/finfo.c
 +}
 diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 --- /usr/share/empty/fs/aufs/f_op.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/f_op.c	2020-01-27 10:57:18.172204883 +0100
-@@ -0,0 +1,819 @@
++++ linux/fs/aufs/f_op.c	2020-12-15 14:10:58.914689728 +0100
+@@ -0,0 +1,762 @@
 +// SPDX-License-Identifier: GPL-2.0
 +/*
 + * Copyright (C) 2005-2020 Junjiro R. Okajima
@@ -15744,34 +15671,6 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	fput(h_file);
 +}
 +
-+static ssize_t aufs_read(struct file *file, char __user *buf, size_t count,
-+			 loff_t *ppos)
-+{
-+	ssize_t err;
-+	struct inode *inode;
-+	struct file *h_file;
-+	struct super_block *sb;
-+
-+	inode = file_inode(file);
-+	sb = inode->i_sb;
-+	si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW);
-+
-+	h_file = au_read_pre(file, /*keep_fi*/0, /*lsc*/0);
-+	err = PTR_ERR(h_file);
-+	if (IS_ERR(h_file))
-+		goto out;
-+
-+	/* filedata may be obsoleted by concurrent copyup, but no problem */
-+	err = vfsub_read_u(h_file, buf, count, ppos);
-+	/* todo: necessary? */
-+	/* file->f_ra = h_file->f_ra; */
-+	au_read_post(inode, h_file);
-+
-+out:
-+	si_read_unlock(sb);
-+	return err;
-+}
-+
 +/*
 + * todo: very ugly
 + * it locks both of i_mutex and si_rwsem for read in safe.
@@ -15794,33 +15693,6 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	}
 +}
 +
-+static ssize_t aufs_write(struct file *file, const char __user *ubuf,
-+			  size_t count, loff_t *ppos)
-+{
-+	ssize_t err;
-+	struct au_write_pre wpre;
-+	struct inode *inode;
-+	struct file *h_file;
-+	char __user *buf = (char __user *)ubuf;
-+
-+	inode = file_inode(file);
-+	au_mtx_and_read_lock(inode);
-+
-+	wpre.lsc = 0;
-+	h_file = au_write_pre(file, /*do_ready*/1, &wpre);
-+	err = PTR_ERR(h_file);
-+	if (IS_ERR(h_file))
-+		goto out;
-+
-+	err = vfsub_write_u(h_file, buf, count, ppos);
-+	au_write_post(inode, h_file, &wpre, err);
-+
-+out:
-+	si_read_unlock(inode->i_sb);
-+	inode_unlock(inode);
-+	return err;
-+}
-+
 +static ssize_t au_do_iter(struct file *h_file, int rw, struct kiocb *kio,
 +			  struct iov_iter *iov_iter)
 +{
@@ -16290,8 +16162,6 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +
 +	.llseek		= default_llseek,
 +
-+	.read		= aufs_read,
-+	.write		= aufs_write,
 +	.read_iter	= aufs_read_iter,
 +	.write_iter	= aufs_write_iter,
 +
@@ -16795,7 +16665,7 @@ diff -urN /usr/share/empty/fs/aufs/hbl.h linux/fs/aufs/hbl.h
 +#endif /* __AUFS_HBL_H__ */
 diff -urN /usr/share/empty/fs/aufs/hfsnotify.c linux/fs/aufs/hfsnotify.c
 --- /usr/share/empty/fs/aufs/hfsnotify.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/hfsnotify.c	2020-01-27 10:57:18.172204883 +0100
++++ linux/fs/aufs/hfsnotify.c	2020-12-15 14:10:58.918023162 +0100
 @@ -0,0 +1,288 @@
 +// SPDX-License-Identifier: GPL-2.0
 +/*
@@ -16960,7 +16830,7 @@ diff -urN /usr/share/empty/fs/aufs/hfsnotify.c linux/fs/aufs/hfsnotify.c
 +
 +static int au_hfsn_handle_event(struct fsnotify_group *group,
 +				u32 mask, const void *data, int data_type,
-+				struct inode *inode,
++				struct inode *dir,
 +				const struct qstr *file_name, u32 cookie,
 +				struct fsnotify_iter_info *iter_info)
 +{
@@ -16977,7 +16847,7 @@ diff -urN /usr/share/empty/fs/aufs/hfsnotify.c linux/fs/aufs/hfsnotify.c
 +	if (mask & (FS_IN_IGNORED | FS_UNMOUNT))
 +		goto out;
 +
-+	h_dir = inode;
++	h_dir = dir;
 +	h_inode = NULL;
 +#ifdef AuDbgHnotify
 +	au_debug_on();
@@ -30487,8 +30357,8 @@ diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c
 +};
 diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 --- /usr/share/empty/fs/aufs/super.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/super.h	2020-01-27 10:57:18.178871751 +0100
-@@ -0,0 +1,589 @@
++++ linux/fs/aufs/super.h	2020-12-15 14:10:58.918023162 +0100
+@@ -0,0 +1,587 @@
 +/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2020 Junjiro R. Okajima
@@ -30622,8 +30492,6 @@ diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 +	unsigned int		si_mntflags;
 +
 +	/* external inode number (bitmap and translation table) */
-+	vfs_readf_t		si_xread;
-+	vfs_writef_t		si_xwrite;
 +	loff_t			si_ximaxent;	/* max entries in a xino */
 +
 +	struct file		*si_xib;
@@ -32714,8 +32582,8 @@ diff -urN /usr/share/empty/fs/aufs/vdir.c linux/fs/aufs/vdir.c
 +}
 diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c
 --- /usr/share/empty/fs/aufs/vfsub.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/vfsub.c	2020-08-03 09:14:46.095748745 +0200
-@@ -0,0 +1,895 @@
++++ linux/fs/aufs/vfsub.c	2020-12-15 14:10:58.921356596 +0100
+@@ -0,0 +1,885 @@
 +// SPDX-License-Identifier: GPL-2.0
 +/*
 + * Copyright (C) 2005-2020 Junjiro R. Okajima
@@ -33231,22 +33099,17 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c
 +	return err;
 +}
 +
-+/* todo: kernel_read()? */
 +ssize_t vfsub_read_k(struct file *file, void *kbuf, size_t count,
 +		     loff_t *ppos)
 +{
 +	ssize_t err;
-+	mm_segment_t oldfs;
-+	union {
-+		void *k;
-+		char __user *u;
-+	} buf;
 +
-+	buf.k = kbuf;
-+	oldfs = get_fs();
-+	set_fs(KERNEL_DS);
-+	err = vfsub_read_u(file, buf.u, count, ppos);
-+	set_fs(oldfs);
++	lockdep_off();
++	err = kernel_read(file, kbuf, count, ppos);
++	lockdep_on();
++	AuTraceErr(err);
++	if (err >= 0)
++		vfsub_update_h_iattr(&file->f_path, /*did*/NULL); /*ignore*/
 +	return err;
 +}
 +
@@ -33266,17 +33129,12 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c
 +ssize_t vfsub_write_k(struct file *file, void *kbuf, size_t count, loff_t *ppos)
 +{
 +	ssize_t err;
-+	mm_segment_t oldfs;
-+	union {
-+		void *k;
-+		const char __user *u;
-+	} buf;
 +
-+	buf.k = kbuf;
-+	oldfs = get_fs();
-+	set_fs(KERNEL_DS);
-+	err = vfsub_write_u(file, buf.u, count, ppos);
-+	set_fs(oldfs);
++	lockdep_off();
++	err = kernel_write(file, kbuf, count, ppos);
++	lockdep_on();
++	if (err >= 0)
++		vfsub_update_h_iattr(&file->f_path, /*did*/NULL); /*ignore*/
 +	return err;
 +}
 +
@@ -36790,8 +36648,8 @@ diff -urN /usr/share/empty/fs/aufs/xattr.c linux/fs/aufs/xattr.c
 +}
 diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 --- /usr/share/empty/fs/aufs/xino.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/xino.c	2020-04-03 08:16:49.834195677 +0200
-@@ -0,0 +1,1966 @@
++++ linux/fs/aufs/xino.c	2020-12-15 14:10:58.924690030 +0100
+@@ -0,0 +1,1925 @@
 +// SPDX-License-Identifier: GPL-2.0
 +/*
 + * Copyright (C) 2005-2020 Junjiro R. Okajima
@@ -37454,8 +37312,8 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	ino_t h_ino, ino;
 +};
 +
-+static int au_xino_do_write(vfs_writef_t write, struct file *file,
-+			    struct au_xi_calc *calc, ino_t ino);
++static int au_xino_do_write(struct file *file, struct au_xi_calc *calc,
++			    ino_t ino);
 +
 +static void au_xino_call_do_new_async(void *args)
 +{
@@ -37484,7 +37342,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +
 +	file = au_xino_file(br->br_xino, a->calc.idx);
 +	AuDebugOn(!file);
-+	err = au_xino_do_write(sbi->si_xwrite, file, &a->calc, a->ino);
++	err = au_xino_do_write(file, &a->calc, a->ino);
 +	if (unlikely(err)) {
 +		AuIOErr("err %d\n", err);
 +		goto out;
@@ -37585,7 +37443,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +		return 0; /* no xino */
 +
 +	sbinfo = au_sbi(sb);
-+	sz = xino_fread(sbinfo->si_xread, file, ino, sizeof(*ino), &calc.pos);
++	sz = xino_fread(file, ino, sizeof(*ino), &calc.pos);
 +	if (sz == sizeof(*ino))
 +		return 0; /* success */
 +
@@ -37597,12 +37455,12 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	return err;
 +}
 +
-+static int au_xino_do_write(vfs_writef_t write, struct file *file,
-+			    struct au_xi_calc *calc, ino_t ino)
++static int au_xino_do_write(struct file *file, struct au_xi_calc *calc,
++			    ino_t ino)
 +{
 +	ssize_t sz;
 +
-+	sz = xino_fwrite(write, file, &ino, sizeof(ino), &calc->pos);
++	sz = xino_fwrite(file, &ino, sizeof(ino), &calc->pos);
 +	if (sz == sizeof(ino))
 +		return 0; /* success */
 +
@@ -37652,7 +37510,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +		goto out;
 +	}
 +
-+	err = au_xino_do_write(au_sbi(sb)->si_xwrite, file, &calc, ino);
++	err = au_xino_do_write(file, &calc, ino);
 +	if (!err) {
 +		br = au_sbr(sb, bindex);
 +		if (au_opt_test(mnt_flags, TRUNC_XINO)
@@ -37666,40 +37524,27 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	return -EIO;
 +}
 +
-+static ssize_t xino_fread_wkq(vfs_readf_t func, struct file *file, void *buf,
-+			      size_t size, loff_t *pos);
++static ssize_t xino_fread_wkq(struct file *file, void *buf, size_t size,
++			      loff_t *pos);
 +
 +/* todo: unnecessary to support mmap_sem since kernel-space? */
-+ssize_t xino_fread(vfs_readf_t func, struct file *file, void *kbuf, size_t size,
-+		   loff_t *pos)
++ssize_t xino_fread(struct file *file, void *kbuf, size_t size, loff_t *pos)
 +{
 +	ssize_t err;
-+	mm_segment_t oldfs;
-+	union {
-+		void *k;
-+		char __user *u;
-+	} buf;
 +	int i;
 +	const int prevent_endless = 10;
 +
 +	i = 0;
-+	buf.k = kbuf;
-+	oldfs = get_fs();
-+	set_fs(KERNEL_DS);
 +	do {
-+		err = func(file, buf.u, size, pos);
++		err = vfsub_read_k(file, kbuf, size, pos);
 +		if (err == -EINTR
 +		    && !au_wkq_test()
 +		    && fatal_signal_pending(current)) {
-+			set_fs(oldfs);
-+			err = xino_fread_wkq(func, file, kbuf, size, pos);
++			err = xino_fread_wkq(file, kbuf, size, pos);
 +			BUG_ON(err == -EINTR);
-+			oldfs = get_fs();
-+			set_fs(KERNEL_DS);
 +		}
 +	} while (i++ < prevent_endless
 +		 && (err == -EAGAIN || err == -EINTR));
-+	set_fs(oldfs);
 +
 +#if 0 /* reserved for future use */
 +	if (err > 0)
@@ -37711,7 +37556,6 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +
 +struct xino_fread_args {
 +	ssize_t *errp;
-+	vfs_readf_t func;
 +	struct file *file;
 +	void *buf;
 +	size_t size;
@@ -37721,17 +37565,16 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +static void call_xino_fread(void *args)
 +{
 +	struct xino_fread_args *a = args;
-+	*a->errp = xino_fread(a->func, a->file, a->buf, a->size, a->pos);
++	*a->errp = xino_fread(a->file, a->buf, a->size, a->pos);
 +}
 +
-+static ssize_t xino_fread_wkq(vfs_readf_t func, struct file *file, void *buf,
-+			      size_t size, loff_t *pos)
++static ssize_t xino_fread_wkq(struct file *file, void *buf, size_t size,
++			      loff_t *pos)
 +{
 +	ssize_t err;
 +	int wkq_err;
 +	struct xino_fread_args args = {
 +		.errp	= &err,
-+		.func	= func,
 +		.file	= file,
 +		.buf	= buf,
 +		.size	= size,
@@ -37745,39 +37588,27 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	return err;
 +}
 +
-+static ssize_t xino_fwrite_wkq(vfs_writef_t func, struct file *file, void *buf,
-+			       size_t size, loff_t *pos);
++static ssize_t xino_fwrite_wkq(struct file *file, void *buf, size_t size,
++			       loff_t *pos);
 +
-+static ssize_t do_xino_fwrite(vfs_writef_t func, struct file *file, void *kbuf,
-+			      size_t size, loff_t *pos)
++static ssize_t do_xino_fwrite(struct file *file, void *kbuf, size_t size,
++			      loff_t *pos)
 +{
 +	ssize_t err;
-+	mm_segment_t oldfs;
-+	union {
-+		void *k;
-+		const char __user *u;
-+	} buf;
 +	int i;
 +	const int prevent_endless = 10;
 +
 +	i = 0;
-+	buf.k = kbuf;
-+	oldfs = get_fs();
-+	set_fs(KERNEL_DS);
 +	do {
-+		err = func(file, buf.u, size, pos);
++		err = vfsub_write_k(file, kbuf, size, pos);
 +		if (err == -EINTR
 +		    && !au_wkq_test()
 +		    && fatal_signal_pending(current)) {
-+			set_fs(oldfs);
-+			err = xino_fwrite_wkq(func, file, kbuf, size, pos);
++			err = xino_fwrite_wkq(file, kbuf, size, pos);
 +			BUG_ON(err == -EINTR);
-+			oldfs = get_fs();
-+			set_fs(KERNEL_DS);
 +		}
 +	} while (i++ < prevent_endless
 +		 && (err == -EAGAIN || err == -EINTR));
-+	set_fs(oldfs);
 +
 +#if 0 /* reserved for future use */
 +	if (err > 0)
@@ -37789,7 +37620,6 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +
 +struct do_xino_fwrite_args {
 +	ssize_t *errp;
-+	vfs_writef_t func;
 +	struct file *file;
 +	void *buf;
 +	size_t size;
@@ -37799,17 +37629,16 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +static void call_do_xino_fwrite(void *args)
 +{
 +	struct do_xino_fwrite_args *a = args;
-+	*a->errp = do_xino_fwrite(a->func, a->file, a->buf, a->size, a->pos);
++	*a->errp = do_xino_fwrite(a->file, a->buf, a->size, a->pos);
 +}
 +
-+static ssize_t xino_fwrite_wkq(vfs_writef_t func, struct file *file, void *buf,
-+			       size_t size, loff_t *pos)
++static ssize_t xino_fwrite_wkq(struct file *file, void *buf, size_t size,
++			       loff_t *pos)
 +{
 +	ssize_t err;
 +	int wkq_err;
 +	struct do_xino_fwrite_args args = {
 +		.errp	= &err,
-+		.func	= func,
 +		.file	= file,
 +		.buf	= buf,
 +		.size	= size,
@@ -37827,18 +37656,17 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	return err;
 +}
 +
-+ssize_t xino_fwrite(vfs_writef_t func, struct file *file, void *buf,
-+		    size_t size, loff_t *pos)
++ssize_t xino_fwrite(struct file *file, void *buf, size_t size, loff_t *pos)
 +{
 +	ssize_t err;
 +
 +	if (rlimit(RLIMIT_FSIZE) == RLIM_INFINITY) {
 +		lockdep_off();
-+		err = do_xino_fwrite(func, file, buf, size, pos);
++		err = do_xino_fwrite(file, buf, size, pos);
 +		lockdep_on();
 +	} else {
 +		lockdep_off();
-+		err = xino_fwrite_wkq(func, file, buf, size, pos);
++		err = xino_fwrite_wkq(file, buf, size, pos);
 +		lockdep_on();
 +	}
 +
@@ -37889,17 +37717,17 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	p = sbinfo->si_xib_buf;
 +	pos = sbinfo->si_xib_last_pindex;
 +	pos *= PAGE_SIZE;
-+	sz = xino_fwrite(sbinfo->si_xwrite, xib, p, PAGE_SIZE, &pos);
++	sz = xino_fwrite(xib, p, PAGE_SIZE, &pos);
 +	if (unlikely(sz != PAGE_SIZE))
 +		goto out;
 +
 +	pos = pindex;
 +	pos *= PAGE_SIZE;
 +	if (vfsub_f_size_read(xib) >= pos + PAGE_SIZE)
-+		sz = xino_fread(sbinfo->si_xread, xib, p, PAGE_SIZE, &pos);
++		sz = xino_fread(xib, p, PAGE_SIZE, &pos);
 +	else {
 +		memset(p, 0, PAGE_SIZE);
-+		sz = xino_fwrite(sbinfo->si_xwrite, xib, p, PAGE_SIZE, &pos);
++		sz = xino_fwrite(xib, p, PAGE_SIZE, &pos);
 +	}
 +	if (sz == PAGE_SIZE) {
 +		sbinfo->si_xib_last_pindex = pindex;
@@ -37950,7 +37778,6 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	unsigned long pindex;
 +	loff_t pos, pend;
 +	struct au_sbinfo *sbinfo;
-+	vfs_readf_t func;
 +	ino_t *ino;
 +	unsigned long *p;
 +
@@ -37958,11 +37785,10 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	sbinfo = au_sbi(sb);
 +	MtxMustLock(&sbinfo->si_xib_mtx);
 +	p = sbinfo->si_xib_buf;
-+	func = sbinfo->si_xread;
 +	pend = vfsub_f_size_read(file);
 +	pos = 0;
 +	while (pos < pend) {
-+		sz = xino_fread(func, file, page, PAGE_SIZE, &pos);
++		sz = xino_fread(file, page, PAGE_SIZE, &pos);
 +		err = sz;
 +		if (unlikely(sz <= 0))
 +			goto out;
@@ -38051,7 +37877,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	p = sbinfo->si_xib_buf;
 +	memset(p, 0, PAGE_SIZE);
 +	pos = 0;
-+	sz = xino_fwrite(sbinfo->si_xwrite, sbinfo->si_xib, p, PAGE_SIZE, &pos);
++	sz = xino_fwrite(sbinfo->si_xib, p, PAGE_SIZE, &pos);
 +	if (unlikely(sz != PAGE_SIZE)) {
 +		err = sz;
 +		AuIOErr("err %d\n", err);
@@ -38190,7 +38016,6 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	SiMustWriteLock(sb);
 +
 +	sbinfo = au_sbi(sb);
-+	/* unnecessary to clear sbinfo->si_xread and ->si_xwrite */
 +	if (sbinfo->si_xib)
 +		fput(sbinfo->si_xib);
 +	sbinfo->si_xib = NULL;
@@ -38217,8 +38042,6 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	if (sbinfo->si_xib)
 +		fput(sbinfo->si_xib);
 +	sbinfo->si_xib = file;
-+	sbinfo->si_xread = vfs_readf(file);
-+	sbinfo->si_xwrite = vfs_writef(file);
 +	xi_sb = file_inode(file)->i_sb;
 +	sbinfo->si_ximaxent = xi_sb->s_maxbytes;
 +	if (unlikely(sbinfo->si_ximaxent < PAGE_SIZE)) {
@@ -38239,8 +38062,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	sbinfo->si_xib_next_bit = 0;
 +	if (vfsub_f_size_read(file) < PAGE_SIZE) {
 +		pos = 0;
-+		err = xino_fwrite(sbinfo->si_xwrite, file, sbinfo->si_xib_buf,
-+				  PAGE_SIZE, &pos);
++		err = xino_fwrite(file, sbinfo->si_xib_buf, PAGE_SIZE, &pos);
 +		if (unlikely(err != PAGE_SIZE))
 +			goto out_free;
 +	}
@@ -38291,7 +38113,6 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +}
 +
 +struct au_xino_do_set_br {
-+	vfs_writef_t writef;
 +	struct au_branch *br;
 +	ino_t h_ino;
 +	aufs_bindex_t bshared;
@@ -38333,7 +38154,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +		goto out;
 +	AuDebugOn(!file);
 +
-+	err = au_xino_do_write(args->writef, file, &calc, AUFS_ROOT_INO);
++	err = au_xino_do_write(file, &calc, AUFS_ROOT_INO);
 +	if (unlikely(err))
 +		au_xino_put(br);
 +
@@ -38353,7 +38174,6 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +
 +	bbot = au_sbbot(sb);
 +	inode = d_inode(sb->s_root);
-+	args.writef = au_sbi(sb)->si_xwrite;
 +	for (bindex = 0; bindex <= bbot; bindex++) {
 +		args.h_ino = au_h_iptr(inode, bindex)->i_ino;
 +		args.br = au_sbr(sb, bindex);
@@ -38508,7 +38328,6 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +		.br	= br
 +	};
 +
-+	args.writef = au_sbi(sb)->si_xwrite;
 +	args.bshared = sbr_find_shared(sb, /*btop*/0, au_sbbot(sb),
 +				       au_br_sb(br));
 +	err = au_xino_do_set_br(sb, base, &args);
@@ -38592,7 +38411,6 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	struct au_hinode *hi;
 +	struct inode *h_inode;
 +	struct au_branch *br;
-+	vfs_writef_t xwrite;
 +	struct au_xi_calc calc;
 +	struct file *file;
 +
@@ -38614,7 +38432,6 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	if (bindex < 0)
 +		return;
 +
-+	xwrite = au_sbi(sb)->si_xwrite;
 +	try_trunc = !!au_opt_test(mnt_flags, TRUNC_XINO);
 +	hi = au_hinode(iinfo, bindex);
 +	bbot = iinfo->ii_bbot;
@@ -38635,7 +38452,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +		if (IS_ERR_OR_NULL(file))
 +			continue;
 +
-+		err = au_xino_do_write(xwrite, file, &calc, /*ino*/0);
++		err = au_xino_do_write(file, &calc, /*ino*/0);
 +		if (!err && try_trunc
 +		    && au_test_fs_trunc_xino(au_br_sb(br)))
 +			xino_try_trunc(sb, br);
@@ -38760,7 +38577,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +}
 diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/linux/aufs_type.h
 --- /usr/share/empty/include/uapi/linux/aufs_type.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/include/uapi/linux/aufs_type.h	2020-08-03 09:14:46.095748745 +0200
++++ linux/include/uapi/linux/aufs_type.h	2020-10-14 08:51:27.819581640 +0200
 @@ -0,0 +1,452 @@
 +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
 +/*
@@ -39291,16 +39108,16 @@ index 0479902a0cd50..758c8ee4d4e6b 100644
  	return error;
  }
  
-@@ -973,7 +995,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode
- 			  struct block_device *bdev,
- 			  const struct loop_config *config)
+@@ -973,7 +995,7 @@ static void loop_update_rotational(struct loop_device *lo)
+ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
+ 		       struct block_device *bdev, unsigned int arg)
  {
 -	struct file	*file;
 +	struct file	*file, *f, *virt_file = NULL;
  	struct inode	*inode;
  	struct address_space *mapping;
  	struct block_device *claimed_bdev = NULL;
-@@ -989,6 +1011,12 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
+@@ -989,6 +1011,12 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
  	file = fget(arg);
  	if (!file)
  		goto out;
@@ -39313,7 +39130,7 @@ index 0479902a0cd50..758c8ee4d4e6b 100644
  
  	/*
  	 * If we don't hold exclusive handle for the device, upgrade to it
-@@ -1037,6 +1065,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode
+@@ -1079,6 +1079,7 @@ static int loop_configure(struct loop_de
  	lo->use_dio = lo->lo_flags & LO_FLAGS_DIRECT_IO;
  	lo->lo_device = bdev;
  	lo->lo_backing_file = file;
@@ -39321,7 +39138,7 @@ index 0479902a0cd50..758c8ee4d4e6b 100644
  	lo->old_gfp_mask = mapping_gfp_mask(mapping);
  	mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
  
-@@ -1090,6 +1119,8 @@ static int loop_configure(struct loop_device *lo, fmode_t mode
+@@ -1090,6 +1119,8 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
  		bd_abort_claiming(bdev, claimed_bdev, loop_set_fd);
  out_putf:
  	fput(file);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kernel.git/commitdiff/e37dd06aa8802a64332fe12279c3923ddd77794d



More information about the pld-cvs-commit mailing list