Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 28 Jan 2014 16:38:04 +0000 (08:38 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 28 Jan 2014 16:38:04 +0000 (08:38 -0800)
Pull vfs updates from Al Viro:
 "Assorted stuff; the biggest pile here is Christoph's ACL series.  Plus
  assorted cleanups and fixes all over the place...

  There will be another pile later this week"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (43 commits)
  __dentry_path() fixes
  vfs: Remove second variable named error in __dentry_path
  vfs: Is mounted should be testing mnt_ns for NULL or error.
  Fix race when checking i_size on direct i/o read
  hfsplus: remove can_set_xattr
  nfsd: use get_acl and ->set_acl
  fs: remove generic_acl
  nfs: use generic posix ACL infrastructure for v3 Posix ACLs
  gfs2: use generic posix ACL infrastructure
  jfs: use generic posix ACL infrastructure
  xfs: use generic posix ACL infrastructure
  reiserfs: use generic posix ACL infrastructure
  ocfs2: use generic posix ACL infrastructure
  jffs2: use generic posix ACL infrastructure
  hfsplus: use generic posix ACL infrastructure
  f2fs: use generic posix ACL infrastructure
  ext2/3/4: use generic posix ACL infrastructure
  btrfs: use generic posix ACL infrastructure
  fs: make posix_acl_create more useful
  fs: make posix_acl_chmod more useful
  ...

20 files changed:
1  2 
fs/Makefile
fs/btrfs/inode.c
fs/ext4/inode.c
fs/f2fs/f2fs.h
fs/f2fs/file.c
fs/f2fs/namei.c
fs/f2fs/xattr.c
fs/fuse/file.c
fs/gfs2/inode.c
fs/hfsplus/inode.c
fs/ocfs2/file.c
fs/ocfs2/namei.c
fs/posix_acl.c
fs/reiserfs/reiserfs.h
fs/xfs/xfs_iops.c
include/linux/posix_acl.h
include/linux/rcupdate.h
kernel/rcu/update.c
mm/filemap.c
mm/shmem.c

diff --cc fs/Makefile
Simple merge
Simple merge
diff --cc fs/ext4/inode.c
Simple merge
diff --cc fs/f2fs/f2fs.h
Simple merge
diff --cc fs/f2fs/file.c
Simple merge
diff --cc fs/f2fs/namei.c
Simple merge
diff --cc fs/f2fs/xattr.c
Simple merge
diff --cc fs/fuse/file.c
Simple merge
diff --cc fs/gfs2/inode.c
Simple merge
Simple merge
diff --cc fs/ocfs2/file.c
Simple merge
Simple merge
diff --cc fs/posix_acl.c
index 551e61ba15b6047c909594968163eaf26c8cb605,f40df9b665fbc970ee863a20ba779b2ce16073f4..38bae5a0ea257ebc414aef89727f3a652d904c96
  #include <linux/fs.h>
  #include <linux/sched.h>
  #include <linux/posix_acl.h>
+ #include <linux/posix_acl_xattr.h>
+ #include <linux/xattr.h>
  #include <linux/export.h>
- #include <linux/errno.h>
+ #include <linux/user_namespace.h>
  
 -EXPORT_SYMBOL(posix_acl_init);
 -EXPORT_SYMBOL(posix_acl_alloc);
 -EXPORT_SYMBOL(posix_acl_valid);
 -EXPORT_SYMBOL(posix_acl_equiv_mode);
 -EXPORT_SYMBOL(posix_acl_from_mode);
 +struct posix_acl **acl_by_type(struct inode *inode, int type)
 +{
 +      switch (type) {
 +      case ACL_TYPE_ACCESS:
 +              return &inode->i_acl;
 +      case ACL_TYPE_DEFAULT:
 +              return &inode->i_default_acl;
 +      default:
 +              BUG();
 +      }
 +}
 +EXPORT_SYMBOL(acl_by_type);
 +
 +struct posix_acl *get_cached_acl(struct inode *inode, int type)
 +{
 +      struct posix_acl **p = acl_by_type(inode, type);
 +      struct posix_acl *acl = ACCESS_ONCE(*p);
 +      if (acl) {
 +              spin_lock(&inode->i_lock);
 +              acl = *p;
 +              if (acl != ACL_NOT_CACHED)
 +                      acl = posix_acl_dup(acl);
 +              spin_unlock(&inode->i_lock);
 +      }
 +      return acl;
 +}
 +EXPORT_SYMBOL(get_cached_acl);
 +
 +struct posix_acl *get_cached_acl_rcu(struct inode *inode, int type)
 +{
 +      return rcu_dereference(*acl_by_type(inode, type));
 +}
 +EXPORT_SYMBOL(get_cached_acl_rcu);
 +
 +void set_cached_acl(struct inode *inode, int type, struct posix_acl *acl)
 +{
 +      struct posix_acl **p = acl_by_type(inode, type);
 +      struct posix_acl *old;
 +      spin_lock(&inode->i_lock);
 +      old = *p;
 +      rcu_assign_pointer(*p, posix_acl_dup(acl));
 +      spin_unlock(&inode->i_lock);
 +      if (old != ACL_NOT_CACHED)
 +              posix_acl_release(old);
 +}
 +EXPORT_SYMBOL(set_cached_acl);
 +
 +void forget_cached_acl(struct inode *inode, int type)
 +{
 +      struct posix_acl **p = acl_by_type(inode, type);
 +      struct posix_acl *old;
 +      spin_lock(&inode->i_lock);
 +      old = *p;
 +      *p = ACL_NOT_CACHED;
 +      spin_unlock(&inode->i_lock);
 +      if (old != ACL_NOT_CACHED)
 +              posix_acl_release(old);
 +}
 +EXPORT_SYMBOL(forget_cached_acl);
 +
 +void forget_all_cached_acls(struct inode *inode)
 +{
 +      struct posix_acl *old_access, *old_default;
 +      spin_lock(&inode->i_lock);
 +      old_access = inode->i_acl;
 +      old_default = inode->i_default_acl;
 +      inode->i_acl = inode->i_default_acl = ACL_NOT_CACHED;
 +      spin_unlock(&inode->i_lock);
 +      if (old_access != ACL_NOT_CACHED)
 +              posix_acl_release(old_access);
 +      if (old_default != ACL_NOT_CACHED)
 +              posix_acl_release(old_default);
 +}
 +EXPORT_SYMBOL(forget_all_cached_acls);
  
+ struct posix_acl *get_acl(struct inode *inode, int type)
+ {
+       struct posix_acl *acl;
+       acl = get_cached_acl(inode, type);
+       if (acl != ACL_NOT_CACHED)
+               return acl;
+       if (!IS_POSIXACL(inode))
+               return NULL;
+       /*
+        * A filesystem can force a ACL callback by just never filling the
+        * ACL cache. But normally you'd fill the cache either at inode
+        * instantiation time, or on the first ->get_acl call.
+        *
+        * If the filesystem doesn't have a get_acl() function at all, we'll
+        * just create the negative cache entry.
+        */
+       if (!inode->i_op->get_acl) {
+               set_cached_acl(inode, type, NULL);
+               return NULL;
+       }
+       return inode->i_op->get_acl(inode, type);
+ }
+ EXPORT_SYMBOL(get_acl);
  /*
   * Init a fresh posix_acl
   */
Simple merge
Simple merge
index 833099bf8090a24f5be28f6b074c918d5d677119,6b12b3d57e908d0b3627a016491de7f891489d67..3e96a6a7610338ff8ddd825a21ddc9bc5fe52e8b
@@@ -91,12 -94,84 +91,20 @@@ extern int __posix_acl_chmod(struct pos
  extern struct posix_acl *get_posix_acl(struct inode *, int);
  extern int set_posix_acl(struct inode *, int, struct posix_acl *);
  
 -static inline struct posix_acl **acl_by_type(struct inode *inode, int type)
 -{
 -      switch (type) {
 -      case ACL_TYPE_ACCESS:
 -              return &inode->i_acl;
 -      case ACL_TYPE_DEFAULT:
 -              return &inode->i_default_acl;
 -      default:
 -              BUG();
 -      }
 -}
 -
 -static inline struct posix_acl *get_cached_acl(struct inode *inode, int type)
 -{
 -      struct posix_acl **p = acl_by_type(inode, type);
 -      struct posix_acl *acl = ACCESS_ONCE(*p);
 -      if (acl) {
 -              spin_lock(&inode->i_lock);
 -              acl = *p;
 -              if (acl != ACL_NOT_CACHED)
 -                      acl = posix_acl_dup(acl);
 -              spin_unlock(&inode->i_lock);
 -      }
 -      return acl;
 -}
 -
 -static inline struct posix_acl *get_cached_acl_rcu(struct inode *inode, int type)
 -{
 -      return rcu_dereference(*acl_by_type(inode, type));
 -}
 -
 -static inline void set_cached_acl(struct inode *inode,
 -                                int type,
 -                                struct posix_acl *acl)
 -{
 -      struct posix_acl **p = acl_by_type(inode, type);
 -      struct posix_acl *old;
 -      spin_lock(&inode->i_lock);
 -      old = *p;
 -      rcu_assign_pointer(*p, posix_acl_dup(acl));
 -      spin_unlock(&inode->i_lock);
 -      if (old != ACL_NOT_CACHED)
 -              posix_acl_release(old);
 -}
 -
 -static inline void forget_cached_acl(struct inode *inode, int type)
 -{
 -      struct posix_acl **p = acl_by_type(inode, type);
 -      struct posix_acl *old;
 -      spin_lock(&inode->i_lock);
 -      old = *p;
 -      *p = ACL_NOT_CACHED;
 -      spin_unlock(&inode->i_lock);
 -      if (old != ACL_NOT_CACHED)
 -              posix_acl_release(old);
 -}
 -
 -static inline void forget_all_cached_acls(struct inode *inode)
 -{
 -      struct posix_acl *old_access, *old_default;
 -      spin_lock(&inode->i_lock);
 -      old_access = inode->i_acl;
 -      old_default = inode->i_default_acl;
 -      inode->i_acl = inode->i_default_acl = ACL_NOT_CACHED;
 -      spin_unlock(&inode->i_lock);
 -      if (old_access != ACL_NOT_CACHED)
 -              posix_acl_release(old_access);
 -      if (old_default != ACL_NOT_CACHED)
 -              posix_acl_release(old_default);
 -}
+ #ifdef CONFIG_FS_POSIX_ACL
+ extern int posix_acl_chmod(struct inode *, umode_t);
+ extern int posix_acl_create(struct inode *, umode_t *, struct posix_acl **,
+               struct posix_acl **);
+ extern int simple_set_acl(struct inode *, struct posix_acl *, int);
+ extern int simple_acl_create(struct inode *, struct inode *);
 +struct posix_acl **acl_by_type(struct inode *inode, int type);
 +struct posix_acl *get_cached_acl(struct inode *inode, int type);
 +struct posix_acl *get_cached_acl_rcu(struct inode *inode, int type);
 +void set_cached_acl(struct inode *inode, int type, struct posix_acl *acl);
 +void forget_cached_acl(struct inode *inode, int type);
 +void forget_all_cached_acls(struct inode *inode);
  
  static inline void cache_no_acl(struct inode *inode)
  {
Simple merge
Simple merge
diff --cc mm/filemap.c
Simple merge
diff --cc mm/shmem.c
Simple merge