packages (Titanium): kernel-desktop/kernel-desktop-unionfs.patch - up to 2....

cactus cactus at pld-linux.org
Fri May 6 23:56:58 CEST 2011


Author: cactus                       Date: Fri May  6 21:56:58 2011 GMT
Module: packages                      Tag: Titanium
---- Log message:
- up to 2.5.9 for 2.6.38.4

---- Files affected:
packages/kernel-desktop:
   kernel-desktop-unionfs.patch (1.2.2.15 -> 1.2.2.16) 

---- Diffs:

================================================================
Index: packages/kernel-desktop/kernel-desktop-unionfs.patch
diff -u packages/kernel-desktop/kernel-desktop-unionfs.patch:1.2.2.15 packages/kernel-desktop/kernel-desktop-unionfs.patch:1.2.2.16
--- packages/kernel-desktop/kernel-desktop-unionfs.patch:1.2.2.15	Fri Jan  7 18:47:09 2011
+++ packages/kernel-desktop/kernel-desktop-unionfs.patch	Fri May  6 23:56:53 2011
@@ -532,10 +532,10 @@
 +
 +For more information, see <http://unionfs.filesystems.org/>.
 diff --git a/MAINTAINERS b/MAINTAINERS
-index 0094224..6d2421f 100644
+index 80540e3..707c88e 100644
 --- a/MAINTAINERS
 +++ b/MAINTAINERS
-@@ -6003,6 +6003,14 @@ F:	Documentation/cdrom/
+@@ -6272,6 +6272,14 @@ F:	Documentation/cdrom/
  F:	drivers/cdrom/cdrom.c
  F:	include/linux/cdrom.h
  
@@ -551,10 +551,10 @@
  M:	Artem Bityutskiy <dedekind1 at gmail.com>
  W:	http://www.linux-mtd.infradead.org/
 diff --git a/fs/Kconfig b/fs/Kconfig
-index 771f457..5d4c8c6 100644
+index 3db9caa..3dc2dfd 100644
 --- a/fs/Kconfig
 +++ b/fs/Kconfig
-@@ -171,6 +171,7 @@ if MISC_FILESYSTEMS
+@@ -170,6 +170,7 @@ if MISC_FILESYSTEMS
  source "fs/adfs/Kconfig"
  source "fs/affs/Kconfig"
  source "fs/ecryptfs/Kconfig"
@@ -575,22 +575,53 @@
  obj-$(CONFIG_NFS_FS)		+= nfs/
  obj-$(CONFIG_EXPORTFS)		+= exportfs/
 diff --git a/fs/namei.c b/fs/namei.c
-index 5362af9..3183d75 100644
+index 3095ca8..db2a674 100644
 --- a/fs/namei.c
 +++ b/fs/namei.c
-@@ -385,6 +385,7 @@ void release_open_intent(struct nameidata *nd)
- 	else
- 		fput(nd->intent.open.file);
+@@ -562,6 +562,7 @@ void release_open_intent(struct nameidata *nd)
+ 			fput(file);
+ 	}
  }
 +EXPORT_SYMBOL_GPL(release_open_intent);
  
- static inline struct dentry *
- do_revalidate(struct dentry *dentry, struct nameidata *nd)
+ static inline int d_revalidate(struct dentry *dentry, struct nameidata *nd)
+ {
+@@ -1895,6 +1896,22 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
+ 	return __lookup_hash(&this, base, NULL);
+ }
+ 
++/* pass nameidata from caller (useful for NFS) */
++struct dentry *lookup_one_len_nd(const char *name, struct dentry *base,
++				 int len, struct nameidata *nd)
++{
++	int err;
++	struct qstr this;
++
++	WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex));
++
++	err = __lookup_one_len(name, &this, base, len);
++	if (err)
++		return ERR_PTR(err);
++
++	return __lookup_hash(&this, base, nd);
++}
++
+ int user_path_at(int dfd, const char __user *name, unsigned flags,
+ 		 struct path *path)
+ {
+@@ -3581,6 +3598,7 @@ EXPORT_SYMBOL(get_write_access); /* binfmt_aout */
+ EXPORT_SYMBOL(getname);
+ EXPORT_SYMBOL(lock_rename);
+ EXPORT_SYMBOL(lookup_one_len);
++EXPORT_SYMBOL(lookup_one_len_nd);
+ EXPORT_SYMBOL(page_follow_link_light);
+ EXPORT_SYMBOL(page_put_link);
+ EXPORT_SYMBOL(page_readlink);
 diff --git a/fs/splice.c b/fs/splice.c
-index 8f1dfae..7a57fab 100644
+index 50a5d978..a3af841 100644
 --- a/fs/splice.c
 +++ b/fs/splice.c
-@@ -1092,8 +1092,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
+@@ -1081,8 +1081,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
  /*
   * Attempt to initiate a splice from pipe to file.
   */
@@ -601,7 +632,7 @@
  {
  	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *,
  				loff_t *, size_t, unsigned int);
-@@ -1116,13 +1116,14 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+@@ -1105,13 +1105,14 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
  
  	return splice_write(pipe, out, ppos, len, flags);
  }
@@ -619,7 +650,7 @@
  {
  	ssize_t (*splice_read)(struct file *, loff_t *,
  			       struct pipe_inode_info *, size_t, unsigned int);
-@@ -1142,6 +1143,7 @@ static long do_splice_to(struct file *in, loff_t *ppos,
+@@ -1131,6 +1132,7 @@ static long do_splice_to(struct file *in, loff_t *ppos,
  
  	return splice_read(in, ppos, pipe, len, flags);
  }
@@ -627,7 +658,7 @@
  
  /**
   * splice_direct_to_actor - splices data directly between two non-pipes
-@@ -1211,7 +1213,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
+@@ -1200,7 +1202,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
  		size_t read_len;
  		loff_t pos = sd->pos, prev_pos = pos;
  
@@ -636,7 +667,7 @@
  		if (unlikely(ret <= 0))
  			goto out_release;
  
-@@ -1270,8 +1272,8 @@ static int direct_splice_actor(struct pipe_inode_info *pipe,
+@@ -1259,8 +1261,8 @@ static int direct_splice_actor(struct pipe_inode_info *pipe,
  {
  	struct file *file = sd->u.file;
  
@@ -647,7 +678,7 @@
  }
  
  /**
-@@ -1368,7 +1370,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
+@@ -1345,7 +1347,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
  		} else
  			off = &out->f_pos;
  
@@ -656,7 +687,7 @@
  
  		if (off_out && copy_to_user(off_out, off, sizeof(loff_t)))
  			ret = -EFAULT;
-@@ -1388,7 +1390,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
+@@ -1365,7 +1367,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
  		} else
  			off = &in->f_pos;
  
@@ -723,11 +754,11 @@
 +	  If you say Y here, you can turn on debugging output from Unionfs.
 diff --git a/fs/unionfs/Makefile b/fs/unionfs/Makefile
 new file mode 100644
-index 0000000..3d45806
+index 0000000..01f04f7
 --- /dev/null
 +++ b/fs/unionfs/Makefile
 @@ -0,0 +1,17 @@
-+UNIONFS_VERSION="2.5.7 (for 2.6.37-rc1)"
++UNIONFS_VERSION="2.5.9 (for 2.6.38.4)"
 +
 +EXTRA_CFLAGS += -DUNIONFS_VERSION=\"$(UNIONFS_VERSION)\"
 +
@@ -746,12 +777,12 @@
 +endif
 diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
 new file mode 100644
-index 0000000..51ea65e
+index 0000000..9f63b1c
 --- /dev/null
 +++ b/fs/unionfs/commonfops.c
-@@ -0,0 +1,896 @@
+@@ -0,0 +1,898 @@
 +/*
-+ * Copyright (c) 2003-2010 Erez Zadok
++ * Copyright (c) 2003-2011 Erez Zadok
 + * Copyright (c) 2003-2006 Charles P. Wright
 + * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
 + * Copyright (c) 2005-2006 Junjiro Okajima
@@ -760,8 +791,8 @@
 + * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
 + * Copyright (c) 2003      Puja Gupta
 + * Copyright (c) 2003      Harikesavan Krishnan
-+ * Copyright (c) 2003-2010 Stony Brook University
-+ * Copyright (c) 2003-2010 The Research Foundation of SUNY
++ * Copyright (c) 2003-2011 Stony Brook University
++ * Copyright (c) 2003-2011 The Research Foundation of SUNY
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
@@ -1064,7 +1095,7 @@
 +	 * someone has copied up this file from underneath us, we also need
 +	 * to refresh things.
 +	 */
-+	if (d_deleted(dentry) ||
++	if ((d_deleted(dentry) && dbstart(dentry) >= fbstart(file)) ||
 +	    (sbgen <= fgen &&
 +	     dbstart(dentry) == fbstart(file) &&
 +	     unionfs_lower_file(file)))
@@ -1258,8 +1289,11 @@
 +			for (bindex = bstart - 1; bindex >= 0; bindex--) {
 +				err = copyup_file(parent->d_inode, file,
 +						  bstart, bindex, size);
-+				if (!err)
++				if (!err) {
++					/* only one regular file open */
++					fbend(file) = fbstart(file);
 +					break;
++				}
 +			}
 +			return err;
 +		} else {
@@ -1400,7 +1434,7 @@
 +	struct dentry *dentry = file->f_path.dentry;
 +	struct dentry *parent;
 +	int bindex, bstart, bend;
-+	int fgen, err = 0;
++	int err = 0;
 +
 +	/*
 +	 * Since mm/memory.c:might_fault() (under PROVE_LOCKING) was
@@ -1436,7 +1470,6 @@
 +	inodeinfo = UNIONFS_I(inode);
 +
 +	/* fput all the lower files */
-+	fgen = atomic_read(&fileinfo->generation);
 +	bstart = fbstart(file);
 +	bend = fbend(file);
 +
@@ -1648,12 +1681,12 @@
 +}
 diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c
 new file mode 100644
-index 0000000..bba3a75
+index 0000000..37c2654
 --- /dev/null
 +++ b/fs/unionfs/copyup.c
 @@ -0,0 +1,896 @@
 +/*
-+ * Copyright (c) 2003-2010 Erez Zadok
++ * Copyright (c) 2003-2011 Erez Zadok
 + * Copyright (c) 2003-2006 Charles P. Wright
 + * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
 + * Copyright (c) 2005-2006 Junjiro Okajima
@@ -1662,8 +1695,8 @@
 + * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
 + * Copyright (c) 2003      Puja Gupta
 + * Copyright (c) 2003      Harikesavan Krishnan
-+ * Copyright (c) 2003-2010 Stony Brook University
-+ * Copyright (c) 2003-2010 The Research Foundation of SUNY
++ * Copyright (c) 2003-2011 Stony Brook University
++ * Copyright (c) 2003-2011 The Research Foundation of SUNY
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
@@ -2550,15 +2583,15 @@
 +}
 diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c
 new file mode 100644
-index 0000000..100d2c6
+index 0000000..6092e69
 --- /dev/null
 +++ b/fs/unionfs/debug.c
-@@ -0,0 +1,532 @@
+@@ -0,0 +1,548 @@
 +/*
-+ * Copyright (c) 2003-2010 Erez Zadok
++ * Copyright (c) 2003-2011 Erez Zadok
 + * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
-+ * Copyright (c) 2003-2010 Stony Brook University
-+ * Copyright (c) 2003-2010 The Research Foundation of SUNY
++ * Copyright (c) 2003-2011 Stony Brook University
++ * Copyright (c) 2003-2011 The Research Foundation of SUNY
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
@@ -2998,6 +3031,22 @@
 +	}
 +}
 +
++static unsigned int __mnt_get_count(struct vfsmount *mnt)
++{
++#ifdef CONFIG_SMP
++	unsigned int count = 0;
++	int cpu;
++
++	for_each_possible_cpu(cpu) {
++		count += per_cpu_ptr(mnt->mnt_pcp, cpu)->mnt_count;
++	}
++
++	return count;
++#else
++	return mnt->mnt_count;
++#endif
++}
++
 +/* useful to track vfsmount leaks that could cause EBUSY on unmount */
 +void __show_branch_counts(const struct super_block *sb,
 +			  const char *file, const char *fxn, int line)
@@ -3012,7 +3061,7 @@
 +		else
 +			mnt = NULL;
 +		printk(KERN_CONT "%d:",
-+		       (mnt ? atomic_read(&mnt->mnt_count) : -99));
++		       (mnt ? __mnt_get_count(mnt) : -99));
 +	}
 +	printk(KERN_CONT "%s:%s:%d\n", file, fxn, line);
 +}
@@ -3088,12 +3137,12 @@
 +}
 diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c
 new file mode 100644
-index 0000000..a0c3bba
+index 0000000..c0205a4
 --- /dev/null
 +++ b/fs/unionfs/dentry.c
-@@ -0,0 +1,397 @@
+@@ -0,0 +1,406 @@
 +/*
-+ * Copyright (c) 2003-2010 Erez Zadok
++ * Copyright (c) 2003-2011 Erez Zadok
 + * Copyright (c) 2003-2006 Charles P. Wright
 + * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
 + * Copyright (c) 2005-2006 Junjiro Okajima
@@ -3102,8 +3151,8 @@
 + * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
 + * Copyright (c) 2003      Puja Gupta
 + * Copyright (c) 2003      Harikesavan Krishnan
-+ * Copyright (c) 2003-2010 Stony Brook University
-+ * Copyright (c) 2003-2010 The Research Foundation of SUNY
++ * Copyright (c) 2003-2011 Stony Brook University
++ * Copyright (c) 2003-2011 The Research Foundation of SUNY
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
@@ -3286,6 +3335,9 @@
 +	bend = dbend(dentry);
 +	BUG_ON(bstart == -1);
 +	for (bindex = bstart; bindex <= bend; bindex++) {
++		int err;
++		struct nameidata lower_nd;
++
 +		lower_dentry = unionfs_lower_dentry_idx(dentry, bindex);
 +		if (!lower_dentry || !lower_dentry->d_op
 +		    || !lower_dentry->d_op->d_revalidate)
@@ -3298,8 +3350,14 @@
 +		 * invariants).  We will open lower files as and when needed
 +		 * later on.
 +		 */
-+		if (!lower_dentry->d_op->d_revalidate(lower_dentry, NULL))
++		err = init_lower_nd(&lower_nd, LOOKUP_OPEN);
++		if (unlikely(err < 0)) {
++			valid = false;
++			break;
++		}
++		if (!lower_dentry->d_op->d_revalidate(lower_dentry, &lower_nd))
 +			valid = false;
++		release_lower_nd(&lower_nd, err);
 +	}
 +
 +	if (!dentry->d_inode ||
@@ -3491,12 +3549,12 @@
 +};
 diff --git a/fs/unionfs/dirfops.c b/fs/unionfs/dirfops.c
 new file mode 100644
-index 0000000..7da0ff0
+index 0000000..72a9c1a
 --- /dev/null
 +++ b/fs/unionfs/dirfops.c
 @@ -0,0 +1,302 @@
 +/*
-+ * Copyright (c) 2003-2010 Erez Zadok
++ * Copyright (c) 2003-2011 Erez Zadok
 + * Copyright (c) 2003-2006 Charles P. Wright
 + * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
 + * Copyright (c) 2005-2006 Junjiro Okajima
@@ -3505,8 +3563,8 @@
 + * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
 + * Copyright (c) 2003      Puja Gupta
 + * Copyright (c) 2003      Harikesavan Krishnan
-+ * Copyright (c) 2003-2010 Stony Brook University
-+ * Copyright (c) 2003-2010 The Research Foundation of SUNY
++ * Copyright (c) 2003-2011 Stony Brook University
++ * Copyright (c) 2003-2011 The Research Foundation of SUNY
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
@@ -3799,12 +3857,12 @@
 +};
 diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
 new file mode 100644
-index 0000000..033343b
+index 0000000..62ec9af
 --- /dev/null
 +++ b/fs/unionfs/dirhelper.c
 @@ -0,0 +1,158 @@
 +/*
-+ * Copyright (c) 2003-2010 Erez Zadok
++ * Copyright (c) 2003-2011 Erez Zadok
 + * Copyright (c) 2003-2006 Charles P. Wright
 + * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
 + * Copyright (c) 2005-2006 Junjiro Okajima
@@ -3813,8 +3871,8 @@
 + * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
 + * Copyright (c) 2003      Puja Gupta
 + * Copyright (c) 2003      Harikesavan Krishnan
-+ * Copyright (c) 2003-2010 Stony Brook University
-+ * Copyright (c) 2003-2010 The Research Foundation of SUNY
++ * Copyright (c) 2003-2011 Stony Brook University
++ * Copyright (c) 2003-2011 The Research Foundation of SUNY
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
@@ -3963,12 +4021,12 @@
 +}
 diff --git a/fs/unionfs/fanout.h b/fs/unionfs/fanout.h
 new file mode 100644
-index 0000000..5b77eac
+index 0000000..ae1b86a
 --- /dev/null
 +++ b/fs/unionfs/fanout.h
 @@ -0,0 +1,407 @@
 +/*
-+ * Copyright (c) 2003-2010 Erez Zadok
++ * Copyright (c) 2003-2011 Erez Zadok
 + * Copyright (c) 2003-2006 Charles P. Wright
 + * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
 + * Copyright (c) 2005      Arun M. Krishnakumar
@@ -3976,8 +4034,8 @@
 + * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
 + * Copyright (c) 2003      Puja Gupta
 + * Copyright (c) 2003      Harikesavan Krishnan
-+ * Copyright (c) 2003-2010 Stony Brook University
-+ * Copyright (c) 2003-2010 The Research Foundation of SUNY
++ * Copyright (c) 2003-2011 Stony Brook University
++ * Copyright (c) 2003-2011 The Research Foundation of SUNY
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
@@ -4376,12 +4434,12 @@
 +#endif	/* not _FANOUT_H */
 diff --git a/fs/unionfs/file.c b/fs/unionfs/file.c
 new file mode 100644
-index 0000000..1c694c3
+index 0000000..416c52f
 --- /dev/null
 +++ b/fs/unionfs/file.c
 @@ -0,0 +1,382 @@
 +/*
-+ * Copyright (c) 2003-2010 Erez Zadok
++ * Copyright (c) 2003-2011 Erez Zadok
 + * Copyright (c) 2003-2006 Charles P. Wright
 + * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
 + * Copyright (c) 2005-2006 Junjiro Okajima
@@ -4390,8 +4448,8 @@
 + * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
 + * Copyright (c) 2003      Puja Gupta
 + * Copyright (c) 2003      Harikesavan Krishnan
-+ * Copyright (c) 2003-2010 Stony Brook University
-+ * Copyright (c) 2003-2010 The Research Foundation of SUNY
++ * Copyright (c) 2003-2011 Stony Brook University
++ * Copyright (c) 2003-2011 The Research Foundation of SUNY
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
@@ -4764,12 +4822,12 @@
 +};
 diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
 new file mode 100644
-index 0000000..4c36f16
+index 0000000..b207c13
 --- /dev/null
 +++ b/fs/unionfs/inode.c
-@@ -0,0 +1,1061 @@
+@@ -0,0 +1,1099 @@
 +/*
-+ * Copyright (c) 2003-2010 Erez Zadok
++ * Copyright (c) 2003-2011 Erez Zadok
 + * Copyright (c) 2003-2006 Charles P. Wright
 + * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
 + * Copyright (c) 2005-2006 Junjiro Okajima
@@ -4778,8 +4836,8 @@
 + * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
 + * Copyright (c) 2003      Puja Gupta
 + * Copyright (c) 2003      Harikesavan Krishnan
-+ * Copyright (c) 2003-2010 Stony Brook University
-+ * Copyright (c) 2003-2010 The Research Foundation of SUNY
++ * Copyright (c) 2003-2011 Stony Brook University
++ * Copyright (c) 2003-2011 The Research Foundation of SUNY
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
@@ -5513,7 +5571,7 @@
 + * This is a variant of fs/namei.c:permission() or inode_permission() which
 + * skips over EROFS tests (because we perform copyup on EROFS).
 + */
-+static int __inode_permission(struct inode *inode, int mask)
++static int __inode_permission(struct inode *inode, int mask, unsigned int flags)
 +{
 +	int retval;
 +
@@ -5523,7 +5581,7 @@
 +
 +	/* Ordinary permission routines do not understand MAY_APPEND. */
 +	if (inode->i_op && inode->i_op->permission) {
-+		retval = inode->i_op->permission(inode, mask);
++		retval = inode->i_op->permission(inode, mask, flags);
 +		if (!retval) {
 +			/*
 +			 * Exec permission on a regular file is denied if none
@@ -5537,7 +5595,7 @@
 +				return -EACCES;
 +		}
 +	} else {
-+		retval = generic_permission(inode, mask, NULL);
++		retval = generic_permission(inode, mask, flags, NULL);
 +	}
 +	if (retval)
 +		return retval;
@@ -5554,19 +5612,28 @@
 + * unionfs_permission, or anything it calls, will use stale branch
 + * information.
 + */
-+static int unionfs_permission(struct inode *inode, int mask)
++static int unionfs_permission(struct inode *inode, int mask, unsigned int flags)
 +{
 +	struct inode *lower_inode = NULL;
 +	int err = 0;
 +	int bindex, bstart, bend;
-+	const int is_file = !S_ISDIR(inode->i_mode);
++	int is_file;
 +	const int write_mask = (mask & MAY_WRITE) && !(mask & MAY_READ);
-+	struct inode *inode_grabbed = igrab(inode);
-+	struct dentry *dentry = d_find_alias(inode);
++	struct inode *inode_grabbed;
++	struct dentry *dentry;
++
++	if (flags & IPERM_FLAG_RCU) {
++		err = -ECHILD;
++		goto out_nograb;
++	}
 +
++	dentry = d_find_alias(inode);
 +	if (dentry)
 +		unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 +
++	inode_grabbed = igrab(inode);
++	is_file = !S_ISDIR(inode->i_mode);
++
 +	if (!UNIONFS_I(inode)->lower_inodes) {
 +		if (is_file)	/* dirs can be unlinked but chdir'ed to */
 +			err = -ESTALE;	/* force revalidate */
@@ -5607,7 +5674,7 @@
 +		 * copyup taking place later on.  However, if user never had
 +		 * access to the file, then no copyup could ever take place.
 +		 */
-+		err = __inode_permission(lower_inode, mask);
++		err = __inode_permission(lower_inode, mask, flags);
 +		if (err && err != -EACCES && err != EPERM && bindex > 0) {
 +			umode_t mode = lower_inode->i_mode;
 +			if ((is_robranch_super(inode->i_sb, bindex) ||
@@ -5630,7 +5697,7 @@
 +		if (err && err == -EACCES &&
 +		    is_robranch_super(inode->i_sb, bindex) &&
 +		    lower_inode->i_sb->s_magic == NFS_SUPER_MAGIC)
-+			err = generic_permission(lower_inode, mask, NULL);
++			err = generic_permission(lower_inode, mask, flags, NULL);
 +
 +		/*
 +		 * The permissions are an intersection of the overall directory
@@ -5659,6 +5726,7 @@
 +		dput(dentry);
 +	}
 +	iput(inode_grabbed);
++out_nograb:
 +	return err;
 +}
 +
@@ -5671,6 +5739,12 @@
 +	struct inode *lower_inode;
 +	int bstart, bend, bindex;
 +	loff_t size;
++	struct iattr lower_ia;
++
++	/* check if user has permission to change inode */
++	err = inode_change_ok(dentry->d_inode, ia);
++	if (err)
++		goto out_err;
 +
 +	unionfs_read_lock(dentry->d_sb, UNIONFS_SMUTEX_CHILD);
 +	parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
@@ -5697,7 +5771,12 @@
 +		err = -EINVAL;
 +		goto out;
 +	}
-+	lower_inode = unionfs_lower_inode(inode);
++
++	/*
++	 * Get the lower inode directly from lower dentry, in case ibstart
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel-desktop/kernel-desktop-unionfs.patch?r1=1.2.2.15&r2=1.2.2.16&f=u



More information about the pld-cvs-commit mailing list