packages: kernel/kernel-aufs2.patch, kernel/kernel-grsec_full.patch, kernel...

arekm arekm at pld-linux.org
Fri Mar 25 15:33:21 CET 2011


Author: arekm                        Date: Fri Mar 25 14:33:21 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- grsec and aufs update

---- Files affected:
packages/kernel:
   kernel-aufs2.patch (1.17 -> 1.18) , kernel-grsec_full.patch (1.62 -> 1.63) , kernel-tuxonice.patch (1.22 -> 1.23) , kernel.spec (1.896 -> 1.897) 

---- Diffs:

================================================================
Index: packages/kernel/kernel-aufs2.patch
diff -u packages/kernel/kernel-aufs2.patch:1.17 packages/kernel/kernel-aufs2.patch:1.18
--- packages/kernel/kernel-aufs2.patch:1.17	Sun Jan  9 21:46:16 2011
+++ packages/kernel/kernel-aufs2.patch	Fri Mar 25 15:33:14 2011
@@ -1,10 +1,10 @@
-aufs2.1 kbuild patch for linux-2.6.36
+aufs2.1 kbuild patch for linux-2.6.
 
 diff --git a/fs/Kconfig b/fs/Kconfig
-index 3d18530..8f582e1 100644
+index 3db9caa..c9e1f11 100644
 --- a/fs/Kconfig
 +++ b/fs/Kconfig
-@@ -189,6 +189,7 @@ source "fs/romfs/Kconfig"
+@@ -190,6 +190,7 @@ source "fs/romfs/Kconfig"
  source "fs/sysv/Kconfig"
  source "fs/ufs/Kconfig"
  source "fs/exofs/Kconfig"
@@ -13,19 +13,19 @@
  endif # MISC_FILESYSTEMS
  
 diff --git a/fs/Makefile b/fs/Makefile
-index e6ec1d3..b0d795a 100644
+index a7f7cef..95dd4d3 100644
 --- a/fs/Makefile
 +++ b/fs/Makefile
-@@ -126,3 +126,4 @@ obj-$(CONFIG_BTRFS_FS)		+= btrfs/
+@@ -121,3 +121,4 @@ obj-$(CONFIG_BTRFS_FS)		+= btrfs/
  obj-$(CONFIG_GFS2_FS)           += gfs2/
  obj-$(CONFIG_EXOFS_FS)          += exofs/
  obj-$(CONFIG_CEPH_FS)		+= ceph/
 +obj-$(CONFIG_AUFS_FS)           += aufs/
 diff --git a/include/linux/Kbuild b/include/linux/Kbuild
-index 4e8ea8c..b8fc201 100644
+index b0ada6f..5cb5837 100644
 --- a/include/linux/Kbuild
 +++ b/include/linux/Kbuild
-@@ -60,6 +60,7 @@ header-y += atmppp.h
+@@ -64,6 +64,7 @@ header-y += atmppp.h
  header-y += atmsap.h
  header-y += atmsvc.h
  header-y += audit.h
@@ -33,22 +33,19 @@
  header-y += auto_fs.h
  header-y += auto_fs4.h
  header-y += auxvec.h
-aufs2.1 base patch for linux-2.6.36
+aufs2.1 base patch for linux-2.6.
 
 diff --git a/fs/namei.c b/fs/namei.c
-index 24896e8..19d69c5 100644
+index 0087cf9..cd39cdf 100644
 --- a/fs/namei.c
 +++ b/fs/namei.c
-@@ -1159,7 +1159,7 @@ out:
+@@ -1841,12 +1841,12 @@ out:
   * needs parent already locked. Doesn't follow mounts.
   * SMP-safe.
   */
 -static struct dentry *lookup_hash(struct nameidata *nd)
 +struct dentry *lookup_hash(struct nameidata *nd)
  {
- 	int err;
- 
-@@ -1169,7 +1169,7 @@ static struct dentry *lookup_hash(struct nameidata *nd)
  	return __lookup_hash(&nd->last, nd->path.dentry, nd);
  }
  
@@ -58,10 +55,10 @@
  {
  	unsigned long hash;
 diff --git a/fs/splice.c b/fs/splice.c
-index 8f1dfae..278c94f 100644
+index 50a5d97..886e942 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.
   */
@@ -72,7 +69,7 @@
  {
  	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *,
  				loff_t *, size_t, unsigned int);
-@@ -1120,9 +1120,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+@@ -1109,9 +1109,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
  /*
   * Attempt to initiate a splice from a file to a pipe.
   */
@@ -86,10 +83,10 @@
  	ssize_t (*splice_read)(struct file *, loff_t *,
  			       struct pipe_inode_info *, size_t, unsigned int);
 diff --git a/include/linux/namei.h b/include/linux/namei.h
-index 05b441d..91bc74e 100644
+index f276d4f..4eb5fcb 100644
 --- a/include/linux/namei.h
 +++ b/include/linux/namei.h
-@@ -73,6 +73,9 @@ extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
+@@ -79,6 +79,9 @@ extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
  extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
  		int (*open)(struct inode *, struct file *));
  
@@ -98,7 +95,7 @@
 +			    struct dentry *base, int len);
  extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
  
- extern int follow_down(struct path *);
+ extern int follow_down_one(struct path *);
 diff --git a/include/linux/splice.h b/include/linux/splice.h
 index 997c3b4..be9a153 100644
 --- a/include/linux/splice.h
@@ -114,13 +111,13 @@
 +			 unsigned int flags);
 +
  #endif
-aufs2.1 standalone patch for linux-2.6.36
+aufs2.1 standalone patch for linux-2.6.
 
 diff --git a/fs/file_table.c b/fs/file_table.c
-index a04bdd8..f51588f 100644
+index eb36b6b..12f2809 100644
 --- a/fs/file_table.c
 +++ b/fs/file_table.c
-@@ -394,6 +394,8 @@ void file_sb_list_del(struct file *file)
+@@ -393,6 +393,8 @@ void file_sb_list_del(struct file *file)
  	}
  }
  
@@ -130,10 +127,10 @@
  
  /*
 diff --git a/fs/inode.c b/fs/inode.c
-index 8646433..d84944d 100644
+index 0647d80..294b8ad 100644
 --- a/fs/inode.c
 +++ b/fs/inode.c
-@@ -83,6 +83,7 @@ static struct hlist_head *inode_hashtable __read_mostly;
+@@ -82,6 +82,7 @@ static struct hlist_head *inode_hashtable __read_mostly;
   * the i_state of an inode while it is in use..
   */
  DEFINE_SPINLOCK(inode_lock);
@@ -142,10 +139,10 @@
  /*
   * iprune_sem provides exclusion between the kswapd or try_to_free_pages
 diff --git a/fs/namei.c b/fs/namei.c
-index 19d69c5..944842e 100644
+index cd39cdf..db4290c 100644
 --- a/fs/namei.c
 +++ b/fs/namei.c
-@@ -347,6 +347,7 @@ int deny_write_access(struct file * file)
+@@ -353,6 +353,7 @@ int deny_write_access(struct file * file)
  
  	return 0;
  }
@@ -153,15 +150,15 @@
  
  /**
   * path_get - get a reference to a path
-@@ -1168,6 +1169,7 @@ struct dentry *lookup_hash(struct nameidata *nd)
- 		return ERR_PTR(err);
+@@ -1845,6 +1846,7 @@ struct dentry *lookup_hash(struct nameidata *nd)
+ {
  	return __lookup_hash(&nd->last, nd->path.dentry, nd);
  }
 +EXPORT_SYMBOL(lookup_hash);
  
  int __lookup_one_len(const char *name, struct qstr *this,
  		struct dentry *base, int len)
-@@ -1190,6 +1192,7 @@ int __lookup_one_len(const char *name, struct qstr *this,
+@@ -1867,6 +1869,7 @@ int __lookup_one_len(const char *name, struct qstr *this,
  	this->hash = end_name_hash(hash);
  	return 0;
  }
@@ -170,10 +167,10 @@
  /**
   * lookup_one_len - filesystem helper to lookup single pathname component
 diff --git a/fs/namespace.c b/fs/namespace.c
-index a72eaab..36107eb 100644
+index d1edf26..44ca259 100644
 --- a/fs/namespace.c
 +++ b/fs/namespace.c
-@@ -1322,6 +1322,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
+@@ -1465,6 +1465,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
  	}
  	return 0;
  }
@@ -243,7 +240,7 @@
  static int fsnotify_mark_destroy(void *ignored)
  {
 diff --git a/fs/open.c b/fs/open.c
-index d74e198..53ef25e 100644
+index 5a2c6eb..f0fa5b2 100644
 --- a/fs/open.c
 +++ b/fs/open.c
 @@ -60,6 +60,7 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
@@ -255,10 +252,10 @@
  static long do_sys_truncate(const char __user *pathname, loff_t length)
  {
 diff --git a/fs/splice.c b/fs/splice.c
-index 278c94f..033f7ac 100644
+index 886e942..9a77a3e 100644
 --- a/fs/splice.c
 +++ b/fs/splice.c
-@@ -1116,6 +1116,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+@@ -1105,6 +1105,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
  
  	return splice_write(pipe, out, ppos, len, flags);
  }
@@ -266,7 +263,7 @@
  
  /*
   * Attempt to initiate a splice from a file to a pipe.
-@@ -1142,6 +1143,7 @@ long do_splice_to(struct file *in, loff_t *ppos,
+@@ -1131,6 +1132,7 @@ long do_splice_to(struct file *in, loff_t *ppos,
  
  	return splice_read(in, ppos, pipe, len, flags);
  }
@@ -275,10 +272,10 @@
  /**
   * splice_direct_to_actor - splices data directly between two non-pipes
 diff --git a/security/commoncap.c b/security/commoncap.c
-index 9d172e6..8a61084 100644
+index 64c2ed9..e58b5d8 100644
 --- a/security/commoncap.c
 +++ b/security/commoncap.c
-@@ -951,3 +951,4 @@ int cap_file_mmap(struct file *file, unsigned long reqprot,
+@@ -929,3 +929,4 @@ int cap_file_mmap(struct file *file, unsigned long reqprot,
  	}
  	return ret;
  }
@@ -296,10 +293,10 @@
  int devcgroup_inode_mknod(int mode, dev_t dev)
  {
 diff --git a/security/security.c b/security/security.c
-index c53949f..0ae5b91 100644
+index 7b7308a..140afc7 100644
 --- a/security/security.c
 +++ b/security/security.c
-@@ -376,6 +376,7 @@ int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode)
+@@ -359,6 +359,7 @@ int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode)
  		return 0;
  	return security_ops->path_mkdir(dir, dentry, mode);
  }
@@ -307,7 +304,7 @@
  
  int security_path_rmdir(struct path *dir, struct dentry *dentry)
  {
-@@ -383,6 +384,7 @@ int security_path_rmdir(struct path *dir, struct dentry *dentry)
+@@ -366,6 +367,7 @@ int security_path_rmdir(struct path *dir, struct dentry *dentry)
  		return 0;
  	return security_ops->path_rmdir(dir, dentry);
  }
@@ -315,7 +312,7 @@
  
  int security_path_unlink(struct path *dir, struct dentry *dentry)
  {
-@@ -390,6 +392,7 @@ int security_path_unlink(struct path *dir, struct dentry *dentry)
+@@ -373,6 +375,7 @@ int security_path_unlink(struct path *dir, struct dentry *dentry)
  		return 0;
  	return security_ops->path_unlink(dir, dentry);
  }
@@ -323,7 +320,7 @@
  
  int security_path_symlink(struct path *dir, struct dentry *dentry,
  			  const char *old_name)
-@@ -398,6 +401,7 @@ int security_path_symlink(struct path *dir, struct dentry *dentry,
+@@ -381,6 +384,7 @@ int security_path_symlink(struct path *dir, struct dentry *dentry,
  		return 0;
  	return security_ops->path_symlink(dir, dentry, old_name);
  }
@@ -331,7 +328,7 @@
  
  int security_path_link(struct dentry *old_dentry, struct path *new_dir,
  		       struct dentry *new_dentry)
-@@ -406,6 +410,7 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir,
+@@ -389,6 +393,7 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir,
  		return 0;
  	return security_ops->path_link(old_dentry, new_dir, new_dentry);
  }
@@ -339,7 +336,7 @@
  
  int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
  			 struct path *new_dir, struct dentry *new_dentry)
-@@ -416,6 +421,7 @@ int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
+@@ -399,6 +404,7 @@ int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
  	return security_ops->path_rename(old_dir, old_dentry, new_dir,
  					 new_dentry);
  }
@@ -347,7 +344,7 @@
  
  int security_path_truncate(struct path *path)
  {
-@@ -423,6 +429,7 @@ int security_path_truncate(struct path *path)
+@@ -406,6 +412,7 @@ int security_path_truncate(struct path *path)
  		return 0;
  	return security_ops->path_truncate(path);
  }
@@ -355,7 +352,7 @@
  
  int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
  			mode_t mode)
-@@ -431,6 +438,7 @@ int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
+@@ -414,6 +421,7 @@ int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
  		return 0;
  	return security_ops->path_chmod(dentry, mnt, mode);
  }
@@ -363,7 +360,7 @@
  
  int security_path_chown(struct path *path, uid_t uid, gid_t gid)
  {
-@@ -438,6 +446,7 @@ int security_path_chown(struct path *path, uid_t uid, gid_t gid)
+@@ -421,6 +429,7 @@ int security_path_chown(struct path *path, uid_t uid, gid_t gid)
  		return 0;
  	return security_ops->path_chown(path, uid, gid);
  }
@@ -371,7 +368,7 @@
  
  int security_path_chroot(struct path *path)
  {
-@@ -514,6 +523,7 @@ int security_inode_readlink(struct dentry *dentry)
+@@ -497,6 +506,7 @@ int security_inode_readlink(struct dentry *dentry)
  		return 0;
  	return security_ops->inode_readlink(dentry);
  }
@@ -379,15 +376,15 @@
  
  int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd)
  {
-@@ -528,6 +538,7 @@ int security_inode_permission(struct inode *inode, int mask)
+@@ -511,6 +521,7 @@ int security_inode_permission(struct inode *inode, int mask)
  		return 0;
  	return security_ops->inode_permission(inode, mask);
  }
 +EXPORT_SYMBOL(security_inode_permission);
  
- int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
+ int security_inode_exec_permission(struct inode *inode, unsigned int flags)
  {
-@@ -627,6 +638,7 @@ int security_file_permission(struct file *file, int mask)
+@@ -619,6 +630,7 @@ int security_file_permission(struct file *file, int mask)
  
  	return fsnotify_perm(file, mask);
  }
@@ -395,7 +392,7 @@
  
  int security_file_alloc(struct file *file)
  {
-@@ -654,6 +666,7 @@ int security_file_mmap(struct file *file, unsigned long reqprot,
+@@ -646,6 +658,7 @@ int security_file_mmap(struct file *file, unsigned long reqprot,
  		return ret;
  	return ima_file_mmap(file, prot);
  }
@@ -405,7 +402,7 @@
  			    unsigned long prot)
 diff -urN /usr/share/empty/Documentation/ABI/testing/debugfs-aufs linux/Documentation/ABI/testing/debugfs-aufs
 --- /usr/share/empty/Documentation/ABI/testing/debugfs-aufs	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/ABI/testing/debugfs-aufs	2010-11-22 11:52:56.970558852 +0100
++++ linux/Documentation/ABI/testing/debugfs-aufs	2011-03-21 20:22:06.833934512 +0100
 @@ -0,0 +1,37 @@
 +What:		/debug/aufs/si_<id>/
 +Date:		March 2009
@@ -446,7 +443,7 @@
 +		will be empty. About XINO files, see the aufs manual.
 diff -urN /usr/share/empty/Documentation/ABI/testing/sysfs-aufs linux/Documentation/ABI/testing/sysfs-aufs
 --- /usr/share/empty/Documentation/ABI/testing/sysfs-aufs	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/ABI/testing/sysfs-aufs	2010-11-22 11:52:56.970558852 +0100
++++ linux/Documentation/ABI/testing/sysfs-aufs	2011-03-21 20:22:06.833934512 +0100
 @@ -0,0 +1,24 @@
 +What:		/sys/fs/aufs/si_<id>/
 +Date:		March 2009
@@ -474,10 +471,10 @@
 +		will be empty. About XINO files, see the aufs manual.
 diff -urN /usr/share/empty/fs/aufs/aufs.h linux/fs/aufs/aufs.h
 --- /usr/share/empty/fs/aufs/aufs.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/aufs.h	2010-11-22 11:52:56.983894369 +0100
++++ linux/fs/aufs/aufs.h	2011-03-21 20:22:06.850601942 +0100
 @@ -0,0 +1,61 @@
 +/*
-+ * Copyright (C) 2005-2010 Junjiro R. Okajima
++ * Copyright (C) 2005-2011 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -539,10 +536,10 @@
 +#endif /* __AUFS_H__ */
 diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 --- /usr/share/empty/fs/aufs/branch.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/branch.c	2010-11-22 11:52:56.983894369 +0100
-@@ -0,0 +1,1051 @@
++++ linux/fs/aufs/branch.c	2011-03-21 20:22:06.850601942 +0100
+@@ -0,0 +1,1160 @@
 +/*
-+ * Copyright (C) 2005-2010 Junjiro R. Okajima
++ * Copyright (C) 2005-2011 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -563,6 +560,7 @@
 + * branch management
 + */
 +
++#include <linux/compat.h>
 +#include <linux/file.h>
 +#include <linux/statfs.h>
 +#include "aufs.h"
@@ -576,6 +574,8 @@
 +	struct au_wbr *wbr;
 +	struct au_dykey **key;
 +
++	au_hnotify_fin_br(br);
++
 +	if (br->br_xino.xi_file)
 +		fput(br->br_xino.xi_file);
 +	mutex_destroy(&br->br_xino.xi_nondir_mtx);
@@ -667,13 +667,17 @@
 +	if (unlikely(!add_branch))
 +		goto out;
 +
++	err = au_hnotify_init_br(add_branch, perm);
++	if (unlikely(err))
++		goto out_br;
++
 +	add_branch->br_wbr = NULL;
 +	if (au_br_writable(perm)) {
 +		/* may be freed separately at changing the branch permission */
 +		add_branch->br_wbr = kmalloc(sizeof(*add_branch->br_wbr),
 +					     GFP_NOFS);
 +		if (unlikely(!add_branch->br_wbr))
-+			goto out_br;
++			goto out_hnotify;
 +	}
 +
 +	err = au_sbr_realloc(au_sbi(sb), new_nbranch);
@@ -686,6 +690,8 @@
 +
 +	kfree(add_branch->br_wbr);
 +
++out_hnotify:
++	au_hnotify_fin_br(add_branch);
 +out_br:
 +	kfree(add_branch);
 +out:
@@ -1039,7 +1045,7 @@
 +
 +	/*
 +	 * this test/set prevents aufs from handling unnecesary notify events
-+	 * of xino files, in a case of re-adding a writable branch which was
++	 * of xino files, in case of re-adding a writable branch which was
 +	 * once detached from aufs.
 +	 */
 +	if (au_xino_brid(sb) < 0
@@ -1065,6 +1071,18 @@
 +		pr_info(fmt, ##__VA_ARGS__); \
 +} while (0)
 +
++static int au_test_ibusy(struct inode *inode, aufs_bindex_t bstart,
++			 aufs_bindex_t bend)
++{
++	return (inode && !S_ISDIR(inode->i_mode)) || bstart == bend;
++}
++
++static int au_test_dbusy(struct dentry *dentry, aufs_bindex_t bstart,
++			 aufs_bindex_t bend)
++{
++	return au_test_ibusy(dentry->d_inode, bstart, bend);
++}
++
 +/*
 + * test if the branch is deletable or not.
 + */
@@ -1076,7 +1094,6 @@
 +	struct au_dcsub_pages dpages;
 +	struct au_dpage *dpage;
 +	struct dentry *d;
-+	struct inode *inode;
 +
 +	err = au_dpages_init(&dpages, GFP_NOFS);
 +	if (unlikely(err))
@@ -1090,12 +1107,19 @@
 +		ndentry = dpage->ndentry;
 +		for (j = 0; !err && j < ndentry; j++) {
 +			d = dpage->dentries[j];
-+			AuDebugOn(!atomic_read(&d->d_count));
-+			inode = d->d_inode;
-+			if (au_digen(d) == sigen && au_iigen(inode) == sigen)
++			AuDebugOn(!d->d_count);
++			if (!au_digen_test(d, sigen)) {
 +				di_read_lock_child(d, AuLock_IR);
-+			else {
++				if (unlikely(au_dbrange_test(d))) {
++					di_read_unlock(d, AuLock_IR);
++					continue;
++				}
++			} else {
 +				di_write_lock_child(d);
++				if (unlikely(au_dbrange_test(d))) {
++					di_write_unlock(d);
++					continue;
++				}
 +				err = au_reval_dpath(d, sigen);
 +				if (!err)
 +					di_downgrade_lock(d, AuLock_IR);
@@ -1105,14 +1129,16 @@
 +				}
 +			}
 +
++			/* AuDbgDentry(d); */
 +			bstart = au_dbstart(d);
 +			bend = au_dbend(d);
 +			if (bstart <= bindex
 +			    && bindex <= bend
 +			    && au_h_dptr(d, bindex)
-+			    && (!S_ISDIR(inode->i_mode) || bstart == bend)) {
++			    && au_test_dbusy(d, bstart, bend)) {
 +				err = -EBUSY;
 +				AuVerbose(verbose, "busy %.*s\n", AuDLNPair(d));
++				AuDbgDentry(d);
 +			}
 +			di_read_unlock(d, AuLock_IR);
 +		}
@@ -1149,7 +1175,8 @@
 +			ii_read_lock_child(i);
 +		else {
 +			ii_write_lock_child(i);
-+			err = au_refresh_hinode_self(i, /*do_attr*/1);
++			err = au_refresh_hinode_self(i);
++			au_iigen_dec(i);
 +			if (!err)
 +				ii_downgrade_lock(i);
 +			else {
@@ -1163,7 +1190,7 @@
 +		if (bstart <= bindex
 +		    && bindex <= bend
 +		    && au_h_iptr(i, bindex)
-+		    && (!S_ISDIR(i->i_mode) || bstart == bend)) {
++		    && au_test_ibusy(i, bstart, bend)) {
 +			err = -EBUSY;
 +			AuVerbose(verbose, "busy i%lu\n", i->i_ino);
 +			AuDbgInode(i);
@@ -1365,6 +1392,77 @@
 +
 +/* ---------------------------------------------------------------------- */
 +
++static int au_ibusy(struct super_block *sb, struct aufs_ibusy __user *arg)
++{
++	int err;
++	aufs_bindex_t bstart, bend;
++	struct aufs_ibusy ibusy;
++	struct inode *inode, *h_inode;
++
++	err = -EPERM;
++	if (unlikely(!capable(CAP_SYS_ADMIN)))
++		goto out;
++
++	err = copy_from_user(&ibusy, arg, sizeof(ibusy));
++	if (!err)
++		err = !access_ok(VERIFY_WRITE, &arg->h_ino, sizeof(arg->h_ino));
++	if (unlikely(err)) {
++		err = -EFAULT;
++		AuTraceErr(err);
++		goto out;
++	}
++
++	err = -EINVAL;
++	si_read_lock(sb, AuLock_FLUSH);
++	if (unlikely(ibusy.bindex < 0 || ibusy.bindex > au_sbend(sb)))
++		goto out_unlock;
++
++	err = 0;
++	ibusy.h_ino = 0; /* invalid */
++	inode = ilookup(sb, ibusy.ino);
++	if (!inode
++	    || inode->i_ino == AUFS_ROOT_INO
++	    || is_bad_inode(inode))
++		goto out_unlock;
++
++	ii_read_lock_child(inode);
++	bstart = au_ibstart(inode);
++	bend = au_ibend(inode);
++	if (bstart <= ibusy.bindex && ibusy.bindex <= bend) {
++		h_inode = au_h_iptr(inode, ibusy.bindex);
++		if (h_inode && au_test_ibusy(inode, bstart, bend))
++			ibusy.h_ino = h_inode->i_ino;
++	}
++	ii_read_unlock(inode);
++	iput(inode);
++
++out_unlock:
++	si_read_unlock(sb);
++	if (!err) {
++		err = __put_user(ibusy.h_ino, &arg->h_ino);
++		if (unlikely(err)) {
++			err = -EFAULT;
++			AuTraceErr(err);
++		}
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel/kernel-aufs2.patch?r1=1.17&r2=1.18&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel/kernel-grsec_full.patch?r1=1.62&r2=1.63&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel/kernel-tuxonice.patch?r1=1.22&r2=1.23&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel/kernel.spec?r1=1.896&r2=1.897&f=u



More information about the pld-cvs-commit mailing list