aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/Locking6
-rw-r--r--Documentation/filesystems/configfs/configfs.txt2
-rw-r--r--Documentation/filesystems/debugfs.txt24
-rw-r--r--Documentation/filesystems/sysfs.txt2
-rw-r--r--Documentation/filesystems/vfs.txt6
-rw-r--r--arch/alpha/include/asm/ipcbuf.h29
-rw-r--r--arch/alpha/include/asm/types.h5
-rw-r--r--arch/arm/include/asm/ipcbuf.h30
-rw-r--r--arch/arm/include/asm/types.h6
-rw-r--r--arch/arm/mach-msm/smd_debug.c2
-rw-r--r--arch/avr32/include/asm/ipcbuf.h30
-rw-r--r--arch/avr32/include/asm/types.h6
-rw-r--r--arch/cris/include/asm/ipcbuf.h30
-rw-r--r--arch/cris/include/asm/types.h6
-rw-r--r--arch/frv/include/asm/ipcbuf.h31
-rw-r--r--arch/frv/include/asm/types.h6
-rw-r--r--arch/h8300/include/asm/ipcbuf.h30
-rw-r--r--arch/h8300/include/asm/types.h17
-rw-r--r--arch/ia64/include/asm/ipcbuf.h29
-rw-r--r--arch/ia64/include/asm/types.h2
-rw-r--r--arch/m32r/include/asm/ipcbuf.h30
-rw-r--r--arch/m32r/include/asm/types.h6
-rw-r--r--arch/m68k/include/asm/ipcbuf.h30
-rw-r--r--arch/m68k/include/asm/types.h6
-rw-r--r--arch/mips/include/asm/ipcbuf.h29
-rw-r--r--arch/mips/include/asm/types.h6
-rw-r--r--arch/mn10300/include/asm/ipcbuf.h30
-rw-r--r--arch/mn10300/include/asm/types.h6
-rw-r--r--arch/parisc/include/asm/types.h6
-rw-r--r--arch/powerpc/include/asm/spu.h2
-rw-r--r--arch/powerpc/include/asm/types.h6
-rw-r--r--arch/powerpc/kernel/lparcfg.c2
-rw-r--r--arch/powerpc/platforms/cell/spu_syscalls.c4
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c16
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h4
-rw-r--r--arch/powerpc/platforms/cell/spufs/syscalls.c2
-rw-r--r--arch/s390/hypfs/inode.c10
-rw-r--r--arch/s390/include/asm/debug.h4
-rw-r--r--arch/s390/include/asm/types.h2
-rw-r--r--arch/s390/kernel/debug.c8
-rw-r--r--arch/sparc/include/asm/posix_types.h2
-rw-r--r--arch/sparc/include/asm/types.h6
-rw-r--r--arch/x86/kernel/cpuid.c2
-rw-r--r--arch/x86/kernel/msr.c2
-rw-r--r--arch/x86/xen/debugfs.c2
-rw-r--r--arch/x86/xen/debugfs.h2
-rw-r--r--arch/xtensa/include/asm/types.h2
-rw-r--r--block/bsg.c2
-rw-r--r--block/genhd.c2
-rw-r--r--drivers/acpi/battery.c2
-rw-r--r--drivers/acpi/ec_sys.c2
-rw-r--r--drivers/base/core.c4
-rw-r--r--drivers/base/devtmpfs.c8
-rw-r--r--drivers/block/aoe/aoechr.c2
-rw-r--r--drivers/block/pktcdvd.c2
-rw-r--r--drivers/char/mem.c4
-rw-r--r--drivers/char/misc.c2
-rw-r--r--drivers/char/raw.c2
-rw-r--r--drivers/char/tile-srom.c2
-rw-r--r--drivers/firmware/iscsi_ibft.c12
-rw-r--r--drivers/gpu/drm/drm_sysfs.c2
-rw-r--r--drivers/hid/usbhid/hiddev.c2
-rw-r--r--drivers/hwmon/dme1737.c6
-rw-r--r--drivers/hwmon/jc42.c2
-rw-r--r--drivers/hwmon/max1668.c4
-rw-r--r--drivers/hwmon/max6650.c2
-rw-r--r--drivers/hwmon/tmp421.c2
-rw-r--r--drivers/infiniband/core/cm.c2
-rw-r--r--drivers/infiniband/core/user_mad.c2
-rw-r--r--drivers/infiniband/core/uverbs_main.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c6
-rw-r--r--drivers/infiniband/hw/qib/qib_fs.c6
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c2
-rw-r--r--drivers/input/input.c2
-rw-r--r--drivers/input/touchscreen/ad7877.c4
-rw-r--r--drivers/input/touchscreen/tsc2005.c4
-rw-r--r--drivers/media/dvb/ddbridge/ddbridge-core.c2
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c2
-rw-r--r--drivers/media/rc/rc-main.c2
-rw-r--r--drivers/message/i2o/i2o_proc.c2
-rw-r--r--drivers/misc/sgi-gru/gruprocfs.c2
-rw-r--r--drivers/mmc/card/mmc_test.c2
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c2
-rw-r--r--drivers/net/wireless/ath/carl9170/debug.c2
-rw-r--r--drivers/net/wireless/libertas/debugfs.c2
-rw-r--r--drivers/pci/pci-label.c4
-rw-r--r--drivers/platform/x86/asus-laptop.c2
-rw-r--r--drivers/platform/x86/asus-wmi.c4
-rw-r--r--drivers/platform/x86/asus_acpi.c4
-rw-r--r--drivers/platform/x86/ideapad-laptop.c2
-rw-r--r--drivers/platform/x86/intel_menlow.c2
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c4
-rw-r--r--drivers/power/power_supply_sysfs.c4
-rw-r--r--drivers/s390/block/dasd.c4
-rw-r--r--drivers/scsi/be2iscsi/be_iscsi.c2
-rw-r--r--drivers/scsi/be2iscsi/be_iscsi.h2
-rw-r--r--drivers/scsi/be2iscsi/be_main.c12
-rw-r--r--drivers/scsi/bfa/bfad_debugfs.c2
-rw-r--r--drivers/scsi/bnx2i/bnx2i_iscsi.c2
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.c2
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.h2
-rw-r--r--drivers/scsi/iscsi_boot_sysfs.c14
-rw-r--r--drivers/scsi/iscsi_tcp.c2
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c10
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c8
-rw-r--r--drivers/scsi/scsi_transport_spi.c2
-rw-r--r--drivers/scsi/sg.c7
-rw-r--r--drivers/staging/iio/adc/ad7192.c4
-rw-r--r--drivers/staging/iio/adc/ad7606_core.c4
-rw-r--r--drivers/staging/iio/dac/ad5446.c4
-rw-r--r--drivers/staging/iio/dds/ad9834.c4
-rw-r--r--drivers/staging/pohmelfs/dir.c11
-rw-r--r--drivers/staging/pohmelfs/netfs.h2
-rw-r--r--drivers/tty/tty_io.c2
-rw-r--r--drivers/usb/class/usblp.c2
-rw-r--r--drivers/usb/core/file.c2
-rw-r--r--drivers/usb/core/inode.c18
-rw-r--r--drivers/usb/core/sysfs.c4
-rw-r--r--drivers/usb/core/usb.c2
-rw-r--r--drivers/usb/misc/iowarrior.c2
-rw-r--r--drivers/usb/misc/legousbtower.c2
-rw-r--r--fs/9p/v9fs_vfs.h4
-rw-r--r--fs/9p/vfs_inode.c45
-rw-r--r--fs/9p/vfs_inode_dotl.c14
-rw-r--r--fs/9p/vfs_super.c2
-rw-r--r--fs/Makefile2
-rw-r--r--fs/affs/affs.h6
-rw-r--r--fs/affs/amigaffs.c6
-rw-r--r--fs/affs/namei.c8
-rw-r--r--fs/afs/dir.c12
-rw-r--r--fs/attr.c4
-rw-r--r--fs/autofs4/autofs_i.h2
-rw-r--r--fs/autofs4/inode.c2
-rw-r--r--fs/autofs4/root.c4
-rw-r--r--fs/bad_inode.c6
-rw-r--r--fs/bfs/dir.c2
-rw-r--r--fs/btrfs/inode.c10
-rw-r--r--fs/ceph/caps.c4
-rw-r--r--fs/ceph/dir.c12
-rw-r--r--fs/ceph/super.h2
-rw-r--r--fs/cifs/cifs_fs_sb.h4
-rw-r--r--fs/cifs/cifsfs.c2
-rw-r--r--fs/cifs/cifsfs.h6
-rw-r--r--fs/cifs/cifsglob.h4
-rw-r--r--fs/cifs/connect.c2
-rw-r--r--fs/cifs/dir.c4
-rw-r--r--fs/cifs/inode.c4
-rw-r--r--fs/coda/dir.c8
-rw-r--r--fs/compat.c4
-rw-r--r--fs/configfs/configfs_internal.h4
-rw-r--r--fs/configfs/dir.c2
-rw-r--r--fs/configfs/inode.c6
-rw-r--r--fs/cramfs/inode.c2
-rw-r--r--fs/dcache.c10
-rw-r--r--fs/debugfs/file.c22
-rw-r--r--fs/debugfs/inode.c14
-rw-r--r--fs/ecryptfs/inode.c29
-rw-r--r--fs/exofs/dir.c2
-rw-r--r--fs/exofs/exofs.h2
-rw-r--r--fs/exofs/inode.c2
-rw-r--r--fs/exofs/namei.c6
-rw-r--r--fs/ext2/dir.c2
-rw-r--r--fs/ext2/ext2.h2
-rw-r--r--fs/ext2/ialloc.c2
-rw-r--r--fs/ext2/namei.c6
-rw-r--r--fs/ext3/ialloc.c2
-rw-r--r--fs/ext3/namei.c6
-rw-r--r--fs/ext4/ext4.h2
-rw-r--r--fs/ext4/ialloc.c8
-rw-r--r--fs/ext4/namei.c6
-rw-r--r--fs/fat/fat.h6
-rw-r--r--fs/fat/file.c4
-rw-r--r--fs/fat/namei_msdos.c4
-rw-r--r--fs/fat/namei_vfat.c4
-rw-r--r--fs/fhandle.c4
-rw-r--r--fs/freevxfs/vxfs_inode.c4
-rw-r--r--fs/fuse/dir.c12
-rw-r--r--fs/fuse/fuse_i.h2
-rw-r--r--fs/gfs2/inode.c16
-rw-r--r--fs/hfs/dir.c4
-rw-r--r--fs/hfs/hfs_fs.h2
-rw-r--r--fs/hfs/inode.c2
-rw-r--r--fs/hfsplus/dir.c6
-rw-r--r--fs/hfsplus/hfsplus_fs.h2
-rw-r--r--fs/hfsplus/inode.c2
-rw-r--r--fs/hostfs/hostfs.h2
-rw-r--r--fs/hostfs/hostfs_kern.c6
-rw-r--r--fs/hpfs/namei.c6
-rw-r--r--fs/hugetlbfs/inode.c65
-rw-r--r--fs/inode.c2
-rw-r--r--fs/internal.h4
-rw-r--r--fs/isofs/inode.c4
-rw-r--r--fs/isofs/isofs.h6
-rw-r--r--fs/jffs2/dir.c14
-rw-r--r--fs/jfs/namei.c6
-rw-r--r--fs/logfs/dir.c6
-rw-r--r--fs/logfs/inode.c2
-rw-r--r--fs/logfs/logfs.h2
-rw-r--r--fs/minix/bitmap.c2
-rw-r--r--fs/minix/minix.h2
-rw-r--r--fs/minix/namei.c6
-rw-r--r--fs/mount.h71
-rw-r--r--fs/namei.c55
-rw-r--r--fs/namespace.c689
-rw-r--r--fs/ncpfs/dir.c18
-rw-r--r--fs/ncpfs/ncplib_kernel.h2
-rw-r--r--fs/ncpfs/symlink.c2
-rw-r--r--fs/nfs/dir.c20
-rw-r--r--fs/nfsd/nfsfh.c4
-rw-r--r--fs/nfsd/nfsfh.h2
-rw-r--r--fs/nfsd/vfs.c4
-rw-r--r--fs/nfsd/vfs.h2
-rw-r--r--fs/nilfs2/dir.c2
-rw-r--r--fs/nilfs2/inode.c2
-rw-r--r--fs/nilfs2/namei.c6
-rw-r--r--fs/nilfs2/nilfs.h2
-rw-r--r--fs/notify/fanotify/fanotify_user.c6
-rw-r--r--fs/notify/fsnotify.c9
-rw-r--r--fs/notify/vfsmount_mark.c19
-rw-r--r--fs/ntfs/super.c6
-rw-r--r--fs/ntfs/volume.h4
-rw-r--r--fs/ocfs2/cluster/netdebug.c2
-rw-r--r--fs/ocfs2/dlmfs/dlmfs.c23
-rw-r--r--fs/ocfs2/namei.c8
-rw-r--r--fs/ocfs2/xattr.c2
-rw-r--r--fs/ocfs2/xattr.h2
-rw-r--r--fs/omfs/dir.c6
-rw-r--r--fs/omfs/inode.c2
-rw-r--r--fs/omfs/omfs.h2
-rw-r--r--fs/open.c18
-rw-r--r--fs/pnode.c105
-rw-r--r--fs/pnode.h38
-rw-r--r--fs/proc/base.c116
-rw-r--r--fs/proc/generic.c8
-rw-r--r--fs/proc/namespaces.c1
-rw-r--r--fs/proc/proc_net.c2
-rw-r--r--fs/proc_namespace.c331
-rw-r--r--fs/ramfs/inode.c8
-rw-r--r--fs/reiserfs/inode.c2
-rw-r--r--fs/reiserfs/namei.c8
-rw-r--r--fs/reiserfs/xattr.c2
-rw-r--r--fs/sysfs/file.c4
-rw-r--r--fs/sysfs/group.c2
-rw-r--r--fs/sysfs/inode.c2
-rw-r--r--fs/sysfs/sysfs.h4
-rw-r--r--fs/sysv/ialloc.c2
-rw-r--r--fs/sysv/namei.c6
-rw-r--r--fs/sysv/sysv.h2
-rw-r--r--fs/ubifs/dir.c14
-rw-r--r--fs/ubifs/ubifs.h2
-rw-r--r--fs/udf/ialloc.c2
-rw-r--r--fs/udf/inode.c6
-rw-r--r--fs/udf/namei.c6
-rw-r--r--fs/udf/super.c12
-rw-r--r--fs/udf/udf_sb.h8
-rw-r--r--fs/udf/udfdecl.h2
-rw-r--r--fs/ufs/ialloc.c2
-rw-r--r--fs/ufs/inode.c4
-rw-r--r--fs/ufs/namei.c6
-rw-r--r--fs/ufs/ufs.h2
-rw-r--r--fs/xfs/xfs_ialloc.c4
-rw-r--r--fs/xfs/xfs_ialloc.h2
-rw-r--r--fs/xfs/xfs_inode.c4
-rw-r--r--fs/xfs/xfs_inode.h2
-rw-r--r--fs/xfs/xfs_iops.c8
-rw-r--r--fs/xfs/xfs_utils.c2
-rw-r--r--fs/xfs/xfs_utils.h2
-rw-r--r--fs/xfs/xfs_vnodeops.c4
-rw-r--r--fs/xfs/xfs_vnodeops.h4
-rw-r--r--include/asm-generic/types.h6
-rw-r--r--include/linux/audit.h8
-rw-r--r--include/linux/cgroup.h2
-rw-r--r--include/linux/compat.h4
-rw-r--r--include/linux/configfs.h2
-rw-r--r--include/linux/debugfs.h46
-rw-r--r--include/linux/device.h6
-rw-r--r--include/linux/ext3_fs.h2
-rw-r--r--include/linux/fs.h20
-rw-r--r--include/linux/genhd.h2
-rw-r--r--include/linux/ide.h2
-rw-r--r--include/linux/ipc.h2
-rw-r--r--include/linux/iscsi_boot_sysfs.h8
-rw-r--r--include/linux/miscdevice.h2
-rw-r--r--include/linux/mnt_namespace.h30
-rw-r--r--include/linux/mount.h35
-rw-r--r--include/linux/proc_fs.h24
-rw-r--r--include/linux/ramfs.h2
-rw-r--r--include/linux/reiserfs_fs.h2
-rw-r--r--include/linux/relay.h2
-rw-r--r--include/linux/security.h36
-rw-r--r--include/linux/shmem_fs.h2
-rw-r--r--include/linux/sunrpc/cache.h2
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h2
-rw-r--r--include/linux/syscalls.h24
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/sysfs.h8
-rw-r--r--include/linux/types.h1
-rw-r--r--include/linux/usb.h2
-rw-r--r--include/scsi/scsi_transport_iscsi.h2
-rw-r--r--include/sound/info.h2
-rw-r--r--init/initramfs.c8
-rw-r--r--ipc/mqueue.c8
-rw-r--r--kernel/auditsc.c20
-rw-r--r--kernel/cgroup.c18
-rw-r--r--kernel/relay.c2
-rw-r--r--kernel/sched.c2
-rw-r--r--kernel/trace/blktrace.c2
-rw-r--r--kernel/trace/trace.c2
-rw-r--r--kernel/trace/trace.h2
-rw-r--r--lib/fault-inject.c8
-rw-r--r--mm/failslab.c2
-rw-r--r--mm/filemap.c2
-rw-r--r--mm/page_alloc.c2
-rw-r--r--mm/shmem.c12
-rw-r--r--net/sunrpc/cache.c2
-rw-r--r--net/sunrpc/rpc_pipe.c2
-rw-r--r--net/unix/af_unix.c2
-rw-r--r--security/apparmor/apparmorfs.c2
-rw-r--r--security/apparmor/lsm.c6
-rw-r--r--security/capability.c12
-rw-r--r--security/inode.c14
-rw-r--r--security/security.c12
-rw-r--r--security/selinux/hooks.c8
-rw-r--r--security/tomoyo/audit.c4
-rw-r--r--security/tomoyo/common.h2
-rw-r--r--security/tomoyo/realpath.c1
-rw-r--r--security/tomoyo/securityfs_if.c2
-rw-r--r--security/tomoyo/tomoyo.c6
-rw-r--r--sound/sound_core.c2
329 files changed, 1571 insertions, 1948 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index d819ba16a0c7..9e9f30b9f46b 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -37,15 +37,15 @@ d_manage: no no yes (ref-walk) maybe
37 37
38--------------------------- inode_operations --------------------------- 38--------------------------- inode_operations ---------------------------
39prototypes: 39prototypes:
40 int (*create) (struct inode *,struct dentry *,int, struct nameidata *); 40 int (*create) (struct inode *,struct dentry *,umode_t, struct nameidata *);
41 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameid 41 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameid
42ata *); 42ata *);
43 int (*link) (struct dentry *,struct inode *,struct dentry *); 43 int (*link) (struct dentry *,struct inode *,struct dentry *);
44 int (*unlink) (struct inode *,struct dentry *); 44 int (*unlink) (struct inode *,struct dentry *);
45 int (*symlink) (struct inode *,struct dentry *,const char *); 45 int (*symlink) (struct inode *,struct dentry *,const char *);
46 int (*mkdir) (struct inode *,struct dentry *,int); 46 int (*mkdir) (struct inode *,struct dentry *,umode_t);
47 int (*rmdir) (struct inode *,struct dentry *); 47 int (*rmdir) (struct inode *,struct dentry *);
48 int (*mknod) (struct inode *,struct dentry *,int,dev_t); 48 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
49 int (*rename) (struct inode *, struct dentry *, 49 int (*rename) (struct inode *, struct dentry *,
50 struct inode *, struct dentry *); 50 struct inode *, struct dentry *);
51 int (*readlink) (struct dentry *, char __user *,int); 51 int (*readlink) (struct dentry *, char __user *,int);
diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt
index dd57bb6bb390..b40fec9d3f53 100644
--- a/Documentation/filesystems/configfs/configfs.txt
+++ b/Documentation/filesystems/configfs/configfs.txt
@@ -192,7 +192,7 @@ attribute value uses the store_attribute() method.
192 struct configfs_attribute { 192 struct configfs_attribute {
193 char *ca_name; 193 char *ca_name;
194 struct module *ca_owner; 194 struct module *ca_owner;
195 mode_t ca_mode; 195 umode_t ca_mode;
196 }; 196 };
197 197
198When a config_item wants an attribute to appear as a file in the item's 198When a config_item wants an attribute to appear as a file in the item's
diff --git a/Documentation/filesystems/debugfs.txt b/Documentation/filesystems/debugfs.txt
index 742cc06e138f..9281a95d689f 100644
--- a/Documentation/filesystems/debugfs.txt
+++ b/Documentation/filesystems/debugfs.txt
@@ -35,7 +35,7 @@ described below will work.
35 35
36The most general way to create a file within a debugfs directory is with: 36The most general way to create a file within a debugfs directory is with:
37 37
38 struct dentry *debugfs_create_file(const char *name, mode_t mode, 38 struct dentry *debugfs_create_file(const char *name, umode_t mode,
39 struct dentry *parent, void *data, 39 struct dentry *parent, void *data,
40 const struct file_operations *fops); 40 const struct file_operations *fops);
41 41
@@ -53,13 +53,13 @@ actually necessary; the debugfs code provides a number of helper functions
53for simple situations. Files containing a single integer value can be 53for simple situations. Files containing a single integer value can be
54created with any of: 54created with any of:
55 55
56 struct dentry *debugfs_create_u8(const char *name, mode_t mode, 56 struct dentry *debugfs_create_u8(const char *name, umode_t mode,
57 struct dentry *parent, u8 *value); 57 struct dentry *parent, u8 *value);
58 struct dentry *debugfs_create_u16(const char *name, mode_t mode, 58 struct dentry *debugfs_create_u16(const char *name, umode_t mode,
59 struct dentry *parent, u16 *value); 59 struct dentry *parent, u16 *value);
60 struct dentry *debugfs_create_u32(const char *name, mode_t mode, 60 struct dentry *debugfs_create_u32(const char *name, umode_t mode,
61 struct dentry *parent, u32 *value); 61 struct dentry *parent, u32 *value);
62 struct dentry *debugfs_create_u64(const char *name, mode_t mode, 62 struct dentry *debugfs_create_u64(const char *name, umode_t mode,
63 struct dentry *parent, u64 *value); 63 struct dentry *parent, u64 *value);
64 64
65These files support both reading and writing the given value; if a specific 65These files support both reading and writing the given value; if a specific
@@ -67,13 +67,13 @@ file should not be written to, simply set the mode bits accordingly. The
67values in these files are in decimal; if hexadecimal is more appropriate, 67values in these files are in decimal; if hexadecimal is more appropriate,
68the following functions can be used instead: 68the following functions can be used instead:
69 69
70 struct dentry *debugfs_create_x8(const char *name, mode_t mode, 70 struct dentry *debugfs_create_x8(const char *name, umode_t mode,
71 struct dentry *parent, u8 *value); 71 struct dentry *parent, u8 *value);
72 struct dentry *debugfs_create_x16(const char *name, mode_t mode, 72 struct dentry *debugfs_create_x16(const char *name, umode_t mode,
73 struct dentry *parent, u16 *value); 73 struct dentry *parent, u16 *value);
74 struct dentry *debugfs_create_x32(const char *name, mode_t mode, 74 struct dentry *debugfs_create_x32(const char *name, umode_t mode,
75 struct dentry *parent, u32 *value); 75 struct dentry *parent, u32 *value);
76 struct dentry *debugfs_create_x64(const char *name, mode_t mode, 76 struct dentry *debugfs_create_x64(const char *name, umode_t mode,
77 struct dentry *parent, u64 *value); 77 struct dentry *parent, u64 *value);
78 78
79These functions are useful as long as the developer knows the size of the 79These functions are useful as long as the developer knows the size of the
@@ -81,7 +81,7 @@ value to be exported. Some types can have different widths on different
81architectures, though, complicating the situation somewhat. There is a 81architectures, though, complicating the situation somewhat. There is a
82function meant to help out in one special case: 82function meant to help out in one special case:
83 83
84 struct dentry *debugfs_create_size_t(const char *name, mode_t mode, 84 struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
85 struct dentry *parent, 85 struct dentry *parent,
86 size_t *value); 86 size_t *value);
87 87
@@ -90,7 +90,7 @@ a variable of type size_t.
90 90
91Boolean values can be placed in debugfs with: 91Boolean values can be placed in debugfs with:
92 92
93 struct dentry *debugfs_create_bool(const char *name, mode_t mode, 93 struct dentry *debugfs_create_bool(const char *name, umode_t mode,
94 struct dentry *parent, u32 *value); 94 struct dentry *parent, u32 *value);
95 95
96A read on the resulting file will yield either Y (for non-zero values) or 96A read on the resulting file will yield either Y (for non-zero values) or
@@ -104,7 +104,7 @@ Finally, a block of arbitrary binary data can be exported with:
104 unsigned long size; 104 unsigned long size;
105 }; 105 };
106 106
107 struct dentry *debugfs_create_blob(const char *name, mode_t mode, 107 struct dentry *debugfs_create_blob(const char *name, umode_t mode,
108 struct dentry *parent, 108 struct dentry *parent,
109 struct debugfs_blob_wrapper *blob); 109 struct debugfs_blob_wrapper *blob);
110 110
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
index 07235caec22c..a6619b7064b9 100644
--- a/Documentation/filesystems/sysfs.txt
+++ b/Documentation/filesystems/sysfs.txt
@@ -70,7 +70,7 @@ An attribute definition is simply:
70struct attribute { 70struct attribute {
71 char * name; 71 char * name;
72 struct module *owner; 72 struct module *owner;
73 mode_t mode; 73 umode_t mode;
74}; 74};
75 75
76 76
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 43cbd0821721..4b9f0d092a79 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -341,14 +341,14 @@ This describes how the VFS can manipulate an inode in your
341filesystem. As of kernel 2.6.22, the following members are defined: 341filesystem. As of kernel 2.6.22, the following members are defined:
342 342
343struct inode_operations { 343struct inode_operations {
344 int (*create) (struct inode *,struct dentry *,int, struct nameidata *); 344 int (*create) (struct inode *,struct dentry *, umode_t, struct nameidata *);
345 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *); 345 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
346 int (*link) (struct dentry *,struct inode *,struct dentry *); 346 int (*link) (struct dentry *,struct inode *,struct dentry *);
347 int (*unlink) (struct inode *,struct dentry *); 347 int (*unlink) (struct inode *,struct dentry *);
348 int (*symlink) (struct inode *,struct dentry *,const char *); 348 int (*symlink) (struct inode *,struct dentry *,const char *);
349 int (*mkdir) (struct inode *,struct dentry *,int); 349 int (*mkdir) (struct inode *,struct dentry *,umode_t);
350 int (*rmdir) (struct inode *,struct dentry *); 350 int (*rmdir) (struct inode *,struct dentry *);
351 int (*mknod) (struct inode *,struct dentry *,int,dev_t); 351 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
352 int (*rename) (struct inode *, struct dentry *, 352 int (*rename) (struct inode *, struct dentry *,
353 struct inode *, struct dentry *); 353 struct inode *, struct dentry *);
354 int (*readlink) (struct dentry *, char __user *,int); 354 int (*readlink) (struct dentry *, char __user *,int);
diff --git a/arch/alpha/include/asm/ipcbuf.h b/arch/alpha/include/asm/ipcbuf.h
index d9c0e1a50702..84c7e51cb6d0 100644
--- a/arch/alpha/include/asm/ipcbuf.h
+++ b/arch/alpha/include/asm/ipcbuf.h
@@ -1,28 +1 @@
1#ifndef _ALPHA_IPCBUF_H #include <asm-generic/ipcbuf.h>
2#define _ALPHA_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for alpha architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit seq
11 * - 2 miscellaneous 64-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid_t uid;
18 __kernel_gid_t gid;
19 __kernel_uid_t cuid;
20 __kernel_gid_t cgid;
21 __kernel_mode_t mode;
22 unsigned short seq;
23 unsigned short __pad1;
24 unsigned long __unused1;
25 unsigned long __unused2;
26};
27
28#endif /* _ALPHA_IPCBUF_H */
diff --git a/arch/alpha/include/asm/types.h b/arch/alpha/include/asm/types.h
index 881544339c21..0a0579076f4a 100644
--- a/arch/alpha/include/asm/types.h
+++ b/arch/alpha/include/asm/types.h
@@ -15,9 +15,4 @@
15#include <asm-generic/int-l64.h> 15#include <asm-generic/int-l64.h>
16#endif 16#endif
17 17
18#ifndef __ASSEMBLY__
19
20typedef unsigned int umode_t;
21
22#endif /* __ASSEMBLY__ */
23#endif /* _ALPHA_TYPES_H */ 18#endif /* _ALPHA_TYPES_H */
diff --git a/arch/arm/include/asm/ipcbuf.h b/arch/arm/include/asm/ipcbuf.h
index 97683975f7df..84c7e51cb6d0 100644
--- a/arch/arm/include/asm/ipcbuf.h
+++ b/arch/arm/include/asm/ipcbuf.h
@@ -1,29 +1 @@
1#ifndef __ASMARM_IPCBUF_H #include <asm-generic/ipcbuf.h>
2#define __ASMARM_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for arm architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode_t and seq
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned short __pad2;
25 unsigned long __unused1;
26 unsigned long __unused2;
27};
28
29#endif /* __ASMARM_IPCBUF_H */
diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h
index 48192ac3a23a..28beab917ffc 100644
--- a/arch/arm/include/asm/types.h
+++ b/arch/arm/include/asm/types.h
@@ -3,12 +3,6 @@
3 3
4#include <asm-generic/int-ll64.h> 4#include <asm-generic/int-ll64.h>
5 5
6#ifndef __ASSEMBLY__
7
8typedef unsigned short umode_t;
9
10#endif /* __ASSEMBLY__ */
11
12/* 6/*
13 * These aren't exported outside the kernel to avoid name space clashes 7 * These aren't exported outside the kernel to avoid name space clashes
14 */ 8 */
diff --git a/arch/arm/mach-msm/smd_debug.c b/arch/arm/mach-msm/smd_debug.c
index 8736afff82f3..0c56a5aaf588 100644
--- a/arch/arm/mach-msm/smd_debug.c
+++ b/arch/arm/mach-msm/smd_debug.c
@@ -215,7 +215,7 @@ static const struct file_operations debug_ops = {
215 .llseek = default_llseek, 215 .llseek = default_llseek,
216}; 216};
217 217
218static void debug_create(const char *name, mode_t mode, 218static void debug_create(const char *name, umode_t mode,
219 struct dentry *dent, 219 struct dentry *dent,
220 int (*fill)(char *buf, int max)) 220 int (*fill)(char *buf, int max))
221{ 221{
diff --git a/arch/avr32/include/asm/ipcbuf.h b/arch/avr32/include/asm/ipcbuf.h
index 1552c9698f5e..84c7e51cb6d0 100644
--- a/arch/avr32/include/asm/ipcbuf.h
+++ b/arch/avr32/include/asm/ipcbuf.h
@@ -1,29 +1 @@
1#ifndef __ASM_AVR32_IPCBUF_H #include <asm-generic/ipcbuf.h>
2#define __ASM_AVR32_IPCBUF_H
3
4/*
5* The user_ipc_perm structure for AVR32 architecture.
6* Note extra padding because this structure is passed back and forth
7* between kernel and user space.
8*
9* Pad space is left for:
10* - 32-bit mode_t and seq
11* - 2 miscellaneous 32-bit values
12*/
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned short __pad2;
25 unsigned long __unused1;
26 unsigned long __unused2;
27};
28
29#endif /* __ASM_AVR32_IPCBUF_H */
diff --git a/arch/avr32/include/asm/types.h b/arch/avr32/include/asm/types.h
index 72667a3b1af7..9bb2d8b2e6ca 100644
--- a/arch/avr32/include/asm/types.h
+++ b/arch/avr32/include/asm/types.h
@@ -10,12 +10,6 @@
10 10
11#include <asm-generic/int-ll64.h> 11#include <asm-generic/int-ll64.h>
12 12
13#ifndef __ASSEMBLY__
14
15typedef unsigned short umode_t;
16
17#endif /* __ASSEMBLY__ */
18
19/* 13/*
20 * These aren't exported outside the kernel to avoid name space clashes 14 * These aren't exported outside the kernel to avoid name space clashes
21 */ 15 */
diff --git a/arch/cris/include/asm/ipcbuf.h b/arch/cris/include/asm/ipcbuf.h
index 8b0c18b02844..84c7e51cb6d0 100644
--- a/arch/cris/include/asm/ipcbuf.h
+++ b/arch/cris/include/asm/ipcbuf.h
@@ -1,29 +1 @@
1#ifndef __CRIS_IPCBUF_H__ #include <asm-generic/ipcbuf.h>
2#define __CRIS_IPCBUF_H__
3
4/*
5 * The user_ipc_perm structure for CRIS architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode_t and seq
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned short __pad2;
25 unsigned long __unused1;
26 unsigned long __unused2;
27};
28
29#endif /* __CRIS_IPCBUF_H__ */
diff --git a/arch/cris/include/asm/types.h b/arch/cris/include/asm/types.h
index 551a12c0aa01..adaf82780bb4 100644
--- a/arch/cris/include/asm/types.h
+++ b/arch/cris/include/asm/types.h
@@ -3,12 +3,6 @@
3 3
4#include <asm-generic/int-ll64.h> 4#include <asm-generic/int-ll64.h>
5 5
6#ifndef __ASSEMBLY__
7
8typedef unsigned short umode_t;
9
10#endif /* __ASSEMBLY__ */
11
12/* 6/*
13 * These aren't exported outside the kernel to avoid name space clashes 7 * These aren't exported outside the kernel to avoid name space clashes
14 */ 8 */
diff --git a/arch/frv/include/asm/ipcbuf.h b/arch/frv/include/asm/ipcbuf.h
index b546f67e455f..84c7e51cb6d0 100644
--- a/arch/frv/include/asm/ipcbuf.h
+++ b/arch/frv/include/asm/ipcbuf.h
@@ -1,30 +1 @@
1#ifndef __ASM_IPCBUF_H__ #include <asm-generic/ipcbuf.h>
2#define __ASM_IPCBUF_H__
3
4/*
5 * The user_ipc_perm structure for FR-V architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode_t and seq
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned short __pad2;
25 unsigned long __unused1;
26 unsigned long __unused2;
27};
28
29#endif /* __ASM_IPCBUF_H__ */
30
diff --git a/arch/frv/include/asm/types.h b/arch/frv/include/asm/types.h
index aa3e7fdc7f29..390a612f3a58 100644
--- a/arch/frv/include/asm/types.h
+++ b/arch/frv/include/asm/types.h
@@ -14,12 +14,6 @@
14 14
15#include <asm-generic/int-ll64.h> 15#include <asm-generic/int-ll64.h>
16 16
17#ifndef __ASSEMBLY__
18
19typedef unsigned short umode_t;
20
21#endif /* __ASSEMBLY__ */
22
23/* 17/*
24 * These aren't exported outside the kernel to avoid name space clashes 18 * These aren't exported outside the kernel to avoid name space clashes
25 */ 19 */
diff --git a/arch/h8300/include/asm/ipcbuf.h b/arch/h8300/include/asm/ipcbuf.h
index 2cd1ebcc109d..84c7e51cb6d0 100644
--- a/arch/h8300/include/asm/ipcbuf.h
+++ b/arch/h8300/include/asm/ipcbuf.h
@@ -1,29 +1 @@
1#ifndef __H8300_IPCBUF_H__ #include <asm-generic/ipcbuf.h>
2#define __H8300_IPCBUF_H__
3
4/*
5 * The user_ipc_perm structure for H8/300 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode_t and seq
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned short __pad2;
25 unsigned long __unused1;
26 unsigned long __unused2;
27};
28
29#endif /* __H8300_IPCBUF_H__ */
diff --git a/arch/h8300/include/asm/types.h b/arch/h8300/include/asm/types.h
index bb2c91a3522e..07257d9487d8 100644
--- a/arch/h8300/include/asm/types.h
+++ b/arch/h8300/include/asm/types.h
@@ -3,27 +3,10 @@
3 3
4#include <asm-generic/int-ll64.h> 4#include <asm-generic/int-ll64.h>
5 5
6#if !defined(__ASSEMBLY__)
7
8/*
9 * This file is never included by application software unless
10 * explicitly requested (e.g., via linux/types.h) in which case the
11 * application is Linux specific so (user-) name space pollution is
12 * not a major issue. However, for interoperability, libraries still
13 * need to be careful to avoid a name clashes.
14 */
15
16typedef unsigned short umode_t;
17
18/*
19 * These aren't exported outside the kernel to avoid name space clashes
20 */
21#ifdef __KERNEL__ 6#ifdef __KERNEL__
22 7
23#define BITS_PER_LONG 32 8#define BITS_PER_LONG 32
24 9
25#endif /* __KERNEL__ */ 10#endif /* __KERNEL__ */
26 11
27#endif /* __ASSEMBLY__ */
28
29#endif /* _H8300_TYPES_H */ 12#endif /* _H8300_TYPES_H */
diff --git a/arch/ia64/include/asm/ipcbuf.h b/arch/ia64/include/asm/ipcbuf.h
index 079899ae7d32..84c7e51cb6d0 100644
--- a/arch/ia64/include/asm/ipcbuf.h
+++ b/arch/ia64/include/asm/ipcbuf.h
@@ -1,28 +1 @@
1#ifndef _ASM_IA64_IPCBUF_H #include <asm-generic/ipcbuf.h>
2#define _ASM_IA64_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for IA-64 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit seq
11 * - 2 miscellaneous 64-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid_t uid;
18 __kernel_gid_t gid;
19 __kernel_uid_t cuid;
20 __kernel_gid_t cgid;
21 __kernel_mode_t mode;
22 unsigned short seq;
23 unsigned short __pad1;
24 unsigned long __unused1;
25 unsigned long __unused2;
26};
27
28#endif /* _ASM_IA64_IPCBUF_H */
diff --git a/arch/ia64/include/asm/types.h b/arch/ia64/include/asm/types.h
index 82b3939d2718..3f5b122d9975 100644
--- a/arch/ia64/include/asm/types.h
+++ b/arch/ia64/include/asm/types.h
@@ -28,8 +28,6 @@
28# define __IA64_UL(x) ((unsigned long)(x)) 28# define __IA64_UL(x) ((unsigned long)(x))
29# define __IA64_UL_CONST(x) x##UL 29# define __IA64_UL_CONST(x) x##UL
30 30
31typedef unsigned int umode_t;
32
33/* 31/*
34 * These aren't exported outside the kernel to avoid name space clashes 32 * These aren't exported outside the kernel to avoid name space clashes
35 */ 33 */
diff --git a/arch/m32r/include/asm/ipcbuf.h b/arch/m32r/include/asm/ipcbuf.h
index 8d2d7c8ffdb0..84c7e51cb6d0 100644
--- a/arch/m32r/include/asm/ipcbuf.h
+++ b/arch/m32r/include/asm/ipcbuf.h
@@ -1,29 +1 @@
1#ifndef _ASM_M32R_IPCBUF_H #include <asm-generic/ipcbuf.h>
2#define _ASM_M32R_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for m32r architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode_t and seq
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned short __pad2;
25 unsigned long __unused1;
26 unsigned long __unused2;
27};
28
29#endif /* _ASM_M32R_IPCBUF_H */
diff --git a/arch/m32r/include/asm/types.h b/arch/m32r/include/asm/types.h
index bd0035597b3b..bb2eeadecf99 100644
--- a/arch/m32r/include/asm/types.h
+++ b/arch/m32r/include/asm/types.h
@@ -3,12 +3,6 @@
3 3
4#include <asm-generic/int-ll64.h> 4#include <asm-generic/int-ll64.h>
5 5
6#ifndef __ASSEMBLY__
7
8typedef unsigned short umode_t;
9
10#endif /* __ASSEMBLY__ */
11
12/* 6/*
13 * These aren't exported outside the kernel to avoid name space clashes 7 * These aren't exported outside the kernel to avoid name space clashes
14 */ 8 */
diff --git a/arch/m68k/include/asm/ipcbuf.h b/arch/m68k/include/asm/ipcbuf.h
index a623ea3f0955..84c7e51cb6d0 100644
--- a/arch/m68k/include/asm/ipcbuf.h
+++ b/arch/m68k/include/asm/ipcbuf.h
@@ -1,29 +1 @@
1#ifndef __m68k_IPCBUF_H__ #include <asm-generic/ipcbuf.h>
2#define __m68k_IPCBUF_H__
3
4/*
5 * The user_ipc_perm structure for m68k architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode_t and seq
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned short __pad2;
25 unsigned long __unused1;
26 unsigned long __unused2;
27};
28
29#endif /* __m68k_IPCBUF_H__ */
diff --git a/arch/m68k/include/asm/types.h b/arch/m68k/include/asm/types.h
index b17fd115a4e7..89705adcbd52 100644
--- a/arch/m68k/include/asm/types.h
+++ b/arch/m68k/include/asm/types.h
@@ -10,12 +10,6 @@
10 */ 10 */
11#include <asm-generic/int-ll64.h> 11#include <asm-generic/int-ll64.h>
12 12
13#ifndef __ASSEMBLY__
14
15typedef unsigned short umode_t;
16
17#endif /* __ASSEMBLY__ */
18
19/* 13/*
20 * These aren't exported outside the kernel to avoid name space clashes 14 * These aren't exported outside the kernel to avoid name space clashes
21 */ 15 */
diff --git a/arch/mips/include/asm/ipcbuf.h b/arch/mips/include/asm/ipcbuf.h
index d47d08f264e7..84c7e51cb6d0 100644
--- a/arch/mips/include/asm/ipcbuf.h
+++ b/arch/mips/include/asm/ipcbuf.h
@@ -1,28 +1 @@
1#ifndef _ASM_IPCBUF_H #include <asm-generic/ipcbuf.h>
2#define _ASM_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for alpha architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit seq
11 * - 2 miscellaneous 64-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid_t uid;
18 __kernel_gid_t gid;
19 __kernel_uid_t cuid;
20 __kernel_gid_t cgid;
21 __kernel_mode_t mode;
22 unsigned short seq;
23 unsigned short __pad1;
24 unsigned long __unused1;
25 unsigned long __unused2;
26};
27
28#endif /* _ASM_IPCBUF_H */
diff --git a/arch/mips/include/asm/types.h b/arch/mips/include/asm/types.h
index 533812b61881..43bf70ebd3a2 100644
--- a/arch/mips/include/asm/types.h
+++ b/arch/mips/include/asm/types.h
@@ -21,12 +21,6 @@
21# include <asm-generic/int-ll64.h> 21# include <asm-generic/int-ll64.h>
22#endif 22#endif
23 23
24#ifndef __ASSEMBLY__
25
26typedef unsigned short umode_t;
27
28#endif /* __ASSEMBLY__ */
29
30/* 24/*
31 * These aren't exported outside the kernel to avoid name space clashes 25 * These aren't exported outside the kernel to avoid name space clashes
32 */ 26 */
diff --git a/arch/mn10300/include/asm/ipcbuf.h b/arch/mn10300/include/asm/ipcbuf.h
index f6f63d448272..84c7e51cb6d0 100644
--- a/arch/mn10300/include/asm/ipcbuf.h
+++ b/arch/mn10300/include/asm/ipcbuf.h
@@ -1,29 +1 @@
1#ifndef _ASM_IPCBUF_H #include <asm-generic/ipcbuf.h>
2#define _ASM_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for MN10300 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode_t and seq
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned short __pad2;
25 unsigned long __unused1;
26 unsigned long __unused2;
27};
28
29#endif /* _ASM_IPCBUF_H */
diff --git a/arch/mn10300/include/asm/types.h b/arch/mn10300/include/asm/types.h
index c1833eb192e3..713d4ba108a5 100644
--- a/arch/mn10300/include/asm/types.h
+++ b/arch/mn10300/include/asm/types.h
@@ -13,12 +13,6 @@
13 13
14#include <asm-generic/int-ll64.h> 14#include <asm-generic/int-ll64.h>
15 15
16#ifndef __ASSEMBLY__
17
18typedef unsigned short umode_t;
19
20#endif /* __ASSEMBLY__ */
21
22/* 16/*
23 * These aren't exported outside the kernel to avoid name space clashes 17 * These aren't exported outside the kernel to avoid name space clashes
24 */ 18 */
diff --git a/arch/parisc/include/asm/types.h b/arch/parisc/include/asm/types.h
index 80e415c9936d..8866f9bbdeaf 100644
--- a/arch/parisc/include/asm/types.h
+++ b/arch/parisc/include/asm/types.h
@@ -3,10 +3,4 @@
3 3
4#include <asm-generic/int-ll64.h> 4#include <asm-generic/int-ll64.h>
5 5
6#ifndef __ASSEMBLY__
7
8typedef unsigned short umode_t;
9
10#endif /* __ASSEMBLY__ */
11
12#endif 6#endif
diff --git a/arch/powerpc/include/asm/spu.h b/arch/powerpc/include/asm/spu.h
index 4e360bd4a35a..c52640089c93 100644
--- a/arch/powerpc/include/asm/spu.h
+++ b/arch/powerpc/include/asm/spu.h
@@ -237,7 +237,7 @@ extern long spu_sys_callback(struct spu_syscall_block *s);
237struct file; 237struct file;
238struct spufs_calls { 238struct spufs_calls {
239 long (*create_thread)(const char __user *name, 239 long (*create_thread)(const char __user *name,
240 unsigned int flags, mode_t mode, 240 unsigned int flags, umode_t mode,
241 struct file *neighbor); 241 struct file *neighbor);
242 long (*spu_run)(struct file *filp, __u32 __user *unpc, 242 long (*spu_run)(struct file *filp, __u32 __user *unpc,
243 __u32 __user *ustatus); 243 __u32 __user *ustatus);
diff --git a/arch/powerpc/include/asm/types.h b/arch/powerpc/include/asm/types.h
index 8947b9827bc4..b15a52e84b37 100644
--- a/arch/powerpc/include/asm/types.h
+++ b/arch/powerpc/include/asm/types.h
@@ -27,12 +27,6 @@
27 * 2 of the License, or (at your option) any later version. 27 * 2 of the License, or (at your option) any later version.
28 */ 28 */
29 29
30#ifdef __powerpc64__
31typedef unsigned int umode_t;
32#else
33typedef unsigned short umode_t;
34#endif
35
36typedef struct { 30typedef struct {
37 __u32 u[4]; 31 __u32 u[4];
38} __attribute__((aligned(16))) __vector128; 32} __attribute__((aligned(16))) __vector128;
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 84daabe2fcba..578f35f18723 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -783,7 +783,7 @@ static const struct file_operations lparcfg_fops = {
783static int __init lparcfg_init(void) 783static int __init lparcfg_init(void)
784{ 784{
785 struct proc_dir_entry *ent; 785 struct proc_dir_entry *ent;
786 mode_t mode = S_IRUSR | S_IRGRP | S_IROTH; 786 umode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
787 787
788 /* Allow writing if we have FW_FEATURE_SPLPAR */ 788 /* Allow writing if we have FW_FEATURE_SPLPAR */
789 if (firmware_has_feature(FW_FEATURE_SPLPAR) && 789 if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c
index 75530d99eda6..714bbfc3162c 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -65,8 +65,8 @@ static inline void spufs_calls_put(struct spufs_calls *calls) { }
65 65
66#endif /* CONFIG_SPU_FS_MODULE */ 66#endif /* CONFIG_SPU_FS_MODULE */
67 67
68asmlinkage long sys_spu_create(const char __user *name, 68SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
69 unsigned int flags, mode_t mode, int neighbor_fd) 69 umode_t, mode, int, neighbor_fd)
70{ 70{
71 long ret; 71 long ret;
72 struct file *neighbor; 72 struct file *neighbor;
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index d85f8cbdc8b3..d4a094ca96f3 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -91,7 +91,7 @@ spufs_init_once(void *p)
91} 91}
92 92
93static struct inode * 93static struct inode *
94spufs_new_inode(struct super_block *sb, int mode) 94spufs_new_inode(struct super_block *sb, umode_t mode)
95{ 95{
96 struct inode *inode; 96 struct inode *inode;
97 97
@@ -123,7 +123,7 @@ spufs_setattr(struct dentry *dentry, struct iattr *attr)
123 123
124static int 124static int
125spufs_new_file(struct super_block *sb, struct dentry *dentry, 125spufs_new_file(struct super_block *sb, struct dentry *dentry,
126 const struct file_operations *fops, int mode, 126 const struct file_operations *fops, umode_t mode,
127 size_t size, struct spu_context *ctx) 127 size_t size, struct spu_context *ctx)
128{ 128{
129 static const struct inode_operations spufs_file_iops = { 129 static const struct inode_operations spufs_file_iops = {
@@ -193,7 +193,7 @@ static int spufs_rmdir(struct inode *parent, struct dentry *dir)
193} 193}
194 194
195static int spufs_fill_dir(struct dentry *dir, 195static int spufs_fill_dir(struct dentry *dir,
196 const struct spufs_tree_descr *files, int mode, 196 const struct spufs_tree_descr *files, umode_t mode,
197 struct spu_context *ctx) 197 struct spu_context *ctx)
198{ 198{
199 struct dentry *dentry, *tmp; 199 struct dentry *dentry, *tmp;
@@ -263,7 +263,7 @@ EXPORT_SYMBOL_GPL(spufs_context_fops);
263 263
264static int 264static int
265spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags, 265spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags,
266 int mode) 266 umode_t mode)
267{ 267{
268 int ret; 268 int ret;
269 struct inode *inode; 269 struct inode *inode;
@@ -446,7 +446,7 @@ spufs_set_affinity(unsigned int flags, struct spu_context *ctx,
446 446
447static int 447static int
448spufs_create_context(struct inode *inode, struct dentry *dentry, 448spufs_create_context(struct inode *inode, struct dentry *dentry,
449 struct vfsmount *mnt, int flags, int mode, 449 struct vfsmount *mnt, int flags, umode_t mode,
450 struct file *aff_filp) 450 struct file *aff_filp)
451{ 451{
452 int ret; 452 int ret;
@@ -520,7 +520,7 @@ out:
520} 520}
521 521
522static int 522static int
523spufs_mkgang(struct inode *dir, struct dentry *dentry, int mode) 523spufs_mkgang(struct inode *dir, struct dentry *dentry, umode_t mode)
524{ 524{
525 int ret; 525 int ret;
526 struct inode *inode; 526 struct inode *inode;
@@ -583,7 +583,7 @@ out:
583 583
584static int spufs_create_gang(struct inode *inode, 584static int spufs_create_gang(struct inode *inode,
585 struct dentry *dentry, 585 struct dentry *dentry,
586 struct vfsmount *mnt, int mode) 586 struct vfsmount *mnt, umode_t mode)
587{ 587{
588 int ret; 588 int ret;
589 589
@@ -611,7 +611,7 @@ out:
611static struct file_system_type spufs_type; 611static struct file_system_type spufs_type;
612 612
613long spufs_create(struct path *path, struct dentry *dentry, 613long spufs_create(struct path *path, struct dentry *dentry,
614 unsigned int flags, mode_t mode, struct file *filp) 614 unsigned int flags, umode_t mode, struct file *filp)
615{ 615{
616 int ret; 616 int ret;
617 617
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index 099245f230b2..67852ade4c01 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -237,7 +237,7 @@ struct spufs_inode_info {
237struct spufs_tree_descr { 237struct spufs_tree_descr {
238 const char *name; 238 const char *name;
239 const struct file_operations *ops; 239 const struct file_operations *ops;
240 int mode; 240 umode_t mode;
241 size_t size; 241 size_t size;
242}; 242};
243 243
@@ -249,7 +249,7 @@ extern const struct spufs_tree_descr spufs_dir_debug_contents[];
249extern struct spufs_calls spufs_calls; 249extern struct spufs_calls spufs_calls;
250long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status); 250long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status);
251long spufs_create(struct path *nd, struct dentry *dentry, unsigned int flags, 251long spufs_create(struct path *nd, struct dentry *dentry, unsigned int flags,
252 mode_t mode, struct file *filp); 252 umode_t mode, struct file *filp);
253/* ELF coredump callbacks for writing SPU ELF notes */ 253/* ELF coredump callbacks for writing SPU ELF notes */
254extern int spufs_coredump_extra_notes_size(void); 254extern int spufs_coredump_extra_notes_size(void);
255extern int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset); 255extern int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset);
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c
index 71a5b5207266..8591bb62d7fc 100644
--- a/arch/powerpc/platforms/cell/spufs/syscalls.c
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -60,7 +60,7 @@ out:
60} 60}
61 61
62static long do_spu_create(const char __user *pathname, unsigned int flags, 62static long do_spu_create(const char __user *pathname, unsigned int flags,
63 mode_t mode, struct file *neighbor) 63 umode_t mode, struct file *neighbor)
64{ 64{
65 struct path path; 65 struct path path;
66 struct dentry *dentry; 66 struct dentry *dentry;
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 481f4f76f664..98efd2d6207a 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -97,7 +97,7 @@ static void hypfs_delete_tree(struct dentry *root)
97 } 97 }
98} 98}
99 99
100static struct inode *hypfs_make_inode(struct super_block *sb, int mode) 100static struct inode *hypfs_make_inode(struct super_block *sb, umode_t mode)
101{ 101{
102 struct inode *ret = new_inode(sb); 102 struct inode *ret = new_inode(sb);
103 103
@@ -107,7 +107,7 @@ static struct inode *hypfs_make_inode(struct super_block *sb, int mode)
107 ret->i_uid = hypfs_info->uid; 107 ret->i_uid = hypfs_info->uid;
108 ret->i_gid = hypfs_info->gid; 108 ret->i_gid = hypfs_info->gid;
109 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; 109 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
110 if (mode & S_IFDIR) 110 if (S_ISDIR(mode))
111 set_nlink(ret, 2); 111 set_nlink(ret, 2);
112 } 112 }
113 return ret; 113 return ret;
@@ -333,7 +333,7 @@ static void hypfs_kill_super(struct super_block *sb)
333 333
334static struct dentry *hypfs_create_file(struct super_block *sb, 334static struct dentry *hypfs_create_file(struct super_block *sb,
335 struct dentry *parent, const char *name, 335 struct dentry *parent, const char *name,
336 char *data, mode_t mode) 336 char *data, umode_t mode)
337{ 337{
338 struct dentry *dentry; 338 struct dentry *dentry;
339 struct inode *inode; 339 struct inode *inode;
@@ -350,13 +350,13 @@ static struct dentry *hypfs_create_file(struct super_block *sb,
350 dentry = ERR_PTR(-ENOMEM); 350 dentry = ERR_PTR(-ENOMEM);
351 goto fail; 351 goto fail;
352 } 352 }
353 if (mode & S_IFREG) { 353 if (S_ISREG(mode)) {
354 inode->i_fop = &hypfs_file_ops; 354 inode->i_fop = &hypfs_file_ops;
355 if (data) 355 if (data)
356 inode->i_size = strlen(data); 356 inode->i_size = strlen(data);
357 else 357 else
358 inode->i_size = 0; 358 inode->i_size = 0;
359 } else if (mode & S_IFDIR) { 359 } else if (S_ISDIR(mode)) {
360 inode->i_op = &simple_dir_inode_operations; 360 inode->i_op = &simple_dir_inode_operations;
361 inode->i_fop = &simple_dir_operations; 361 inode->i_fop = &simple_dir_operations;
362 inc_nlink(parent->d_inode); 362 inc_nlink(parent->d_inode);
diff --git a/arch/s390/include/asm/debug.h b/arch/s390/include/asm/debug.h
index 18124b75a7ab..9d88db1f55d0 100644
--- a/arch/s390/include/asm/debug.h
+++ b/arch/s390/include/asm/debug.h
@@ -73,7 +73,7 @@ typedef struct debug_info {
73 struct dentry* debugfs_entries[DEBUG_MAX_VIEWS]; 73 struct dentry* debugfs_entries[DEBUG_MAX_VIEWS];
74 struct debug_view* views[DEBUG_MAX_VIEWS]; 74 struct debug_view* views[DEBUG_MAX_VIEWS];
75 char name[DEBUG_MAX_NAME_LEN]; 75 char name[DEBUG_MAX_NAME_LEN];
76 mode_t mode; 76 umode_t mode;
77} debug_info_t; 77} debug_info_t;
78 78
79typedef int (debug_header_proc_t) (debug_info_t* id, 79typedef int (debug_header_proc_t) (debug_info_t* id,
@@ -124,7 +124,7 @@ debug_info_t *debug_register(const char *name, int pages, int nr_areas,
124 int buf_size); 124 int buf_size);
125 125
126debug_info_t *debug_register_mode(const char *name, int pages, int nr_areas, 126debug_info_t *debug_register_mode(const char *name, int pages, int nr_areas,
127 int buf_size, mode_t mode, uid_t uid, 127 int buf_size, umode_t mode, uid_t uid,
128 gid_t gid); 128 gid_t gid);
129 129
130void debug_unregister(debug_info_t* id); 130void debug_unregister(debug_info_t* id);
diff --git a/arch/s390/include/asm/types.h b/arch/s390/include/asm/types.h
index eeb52ccf499f..05ebbcdbbf6b 100644
--- a/arch/s390/include/asm/types.h
+++ b/arch/s390/include/asm/types.h
@@ -13,8 +13,6 @@
13 13
14#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
15 15
16typedef unsigned short umode_t;
17
18/* A address type so that arithmetic can be done on it & it can be upgraded to 16/* A address type so that arithmetic can be done on it & it can be upgraded to
19 64 bit when necessary 17 64 bit when necessary
20*/ 18*/
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index 5ad6bc078bfd..6848828b962e 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -74,7 +74,7 @@ static ssize_t debug_input(struct file *file, const char __user *user_buf,
74static int debug_open(struct inode *inode, struct file *file); 74static int debug_open(struct inode *inode, struct file *file);
75static int debug_close(struct inode *inode, struct file *file); 75static int debug_close(struct inode *inode, struct file *file);
76static debug_info_t *debug_info_create(const char *name, int pages_per_area, 76static debug_info_t *debug_info_create(const char *name, int pages_per_area,
77 int nr_areas, int buf_size, mode_t mode); 77 int nr_areas, int buf_size, umode_t mode);
78static void debug_info_get(debug_info_t *); 78static void debug_info_get(debug_info_t *);
79static void debug_info_put(debug_info_t *); 79static void debug_info_put(debug_info_t *);
80static int debug_prolog_level_fn(debug_info_t * id, 80static int debug_prolog_level_fn(debug_info_t * id,
@@ -330,7 +330,7 @@ debug_info_free(debug_info_t* db_info){
330 330
331static debug_info_t* 331static debug_info_t*
332debug_info_create(const char *name, int pages_per_area, int nr_areas, 332debug_info_create(const char *name, int pages_per_area, int nr_areas,
333 int buf_size, mode_t mode) 333 int buf_size, umode_t mode)
334{ 334{
335 debug_info_t* rc; 335 debug_info_t* rc;
336 336
@@ -688,7 +688,7 @@ debug_close(struct inode *inode, struct file *file)
688 */ 688 */
689 689
690debug_info_t *debug_register_mode(const char *name, int pages_per_area, 690debug_info_t *debug_register_mode(const char *name, int pages_per_area,
691 int nr_areas, int buf_size, mode_t mode, 691 int nr_areas, int buf_size, umode_t mode,
692 uid_t uid, gid_t gid) 692 uid_t uid, gid_t gid)
693{ 693{
694 debug_info_t *rc = NULL; 694 debug_info_t *rc = NULL;
@@ -1090,7 +1090,7 @@ debug_register_view(debug_info_t * id, struct debug_view *view)
1090 int rc = 0; 1090 int rc = 0;
1091 int i; 1091 int i;
1092 unsigned long flags; 1092 unsigned long flags;
1093 mode_t mode; 1093 umode_t mode;
1094 struct dentry *pde; 1094 struct dentry *pde;
1095 1095
1096 if (!id) 1096 if (!id)
diff --git a/arch/sparc/include/asm/posix_types.h b/arch/sparc/include/asm/posix_types.h
index 98d6ebb922fb..dbfc1a34b3a2 100644
--- a/arch/sparc/include/asm/posix_types.h
+++ b/arch/sparc/include/asm/posix_types.h
@@ -20,7 +20,6 @@ typedef unsigned int __kernel_uid_t;
20typedef unsigned int __kernel_gid_t; 20typedef unsigned int __kernel_gid_t;
21typedef unsigned long __kernel_ino_t; 21typedef unsigned long __kernel_ino_t;
22typedef unsigned int __kernel_mode_t; 22typedef unsigned int __kernel_mode_t;
23typedef unsigned short __kernel_umode_t;
24typedef unsigned int __kernel_nlink_t; 23typedef unsigned int __kernel_nlink_t;
25typedef int __kernel_daddr_t; 24typedef int __kernel_daddr_t;
26typedef long __kernel_off_t; 25typedef long __kernel_off_t;
@@ -55,7 +54,6 @@ typedef unsigned short __kernel_uid_t;
55typedef unsigned short __kernel_gid_t; 54typedef unsigned short __kernel_gid_t;
56typedef unsigned long __kernel_ino_t; 55typedef unsigned long __kernel_ino_t;
57typedef unsigned short __kernel_mode_t; 56typedef unsigned short __kernel_mode_t;
58typedef unsigned short __kernel_umode_t;
59typedef short __kernel_nlink_t; 57typedef short __kernel_nlink_t;
60typedef long __kernel_daddr_t; 58typedef long __kernel_daddr_t;
61typedef long __kernel_off_t; 59typedef long __kernel_off_t;
diff --git a/arch/sparc/include/asm/types.h b/arch/sparc/include/asm/types.h
index 91e5a034f987..383d156cde9c 100644
--- a/arch/sparc/include/asm/types.h
+++ b/arch/sparc/include/asm/types.h
@@ -12,12 +12,6 @@
12 12
13#include <asm-generic/int-ll64.h> 13#include <asm-generic/int-ll64.h>
14 14
15#ifndef __ASSEMBLY__
16
17typedef unsigned short umode_t;
18
19#endif /* __ASSEMBLY__ */
20
21#endif /* defined(__sparc__) */ 15#endif /* defined(__sparc__) */
22 16
23#endif /* defined(_SPARC_TYPES_H) */ 17#endif /* defined(_SPARC_TYPES_H) */
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 212a6a42527c..a524353d93f2 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -177,7 +177,7 @@ static struct notifier_block __refdata cpuid_class_cpu_notifier =
177 .notifier_call = cpuid_class_cpu_callback, 177 .notifier_call = cpuid_class_cpu_callback,
178}; 178};
179 179
180static char *cpuid_devnode(struct device *dev, mode_t *mode) 180static char *cpuid_devnode(struct device *dev, umode_t *mode)
181{ 181{
182 return kasprintf(GFP_KERNEL, "cpu/%u/cpuid", MINOR(dev->devt)); 182 return kasprintf(GFP_KERNEL, "cpu/%u/cpuid", MINOR(dev->devt));
183} 183}
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index 12fcbe2c143e..96356762a51d 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -236,7 +236,7 @@ static struct notifier_block __refdata msr_class_cpu_notifier = {
236 .notifier_call = msr_class_cpu_callback, 236 .notifier_call = msr_class_cpu_callback,
237}; 237};
238 238
239static char *msr_devnode(struct device *dev, mode_t *mode) 239static char *msr_devnode(struct device *dev, umode_t *mode)
240{ 240{
241 return kasprintf(GFP_KERNEL, "cpu/%u/msr", MINOR(dev->devt)); 241 return kasprintf(GFP_KERNEL, "cpu/%u/msr", MINOR(dev->devt));
242} 242}
diff --git a/arch/x86/xen/debugfs.c b/arch/x86/xen/debugfs.c
index 7c0fedd98ea0..ef1db1900d86 100644
--- a/arch/x86/xen/debugfs.c
+++ b/arch/x86/xen/debugfs.c
@@ -109,7 +109,7 @@ static const struct file_operations u32_array_fops = {
109 .llseek = no_llseek, 109 .llseek = no_llseek,
110}; 110};
111 111
112struct dentry *xen_debugfs_create_u32_array(const char *name, mode_t mode, 112struct dentry *xen_debugfs_create_u32_array(const char *name, umode_t mode,
113 struct dentry *parent, 113 struct dentry *parent,
114 u32 *array, unsigned elements) 114 u32 *array, unsigned elements)
115{ 115{
diff --git a/arch/x86/xen/debugfs.h b/arch/x86/xen/debugfs.h
index e28132084832..78d25499be5b 100644
--- a/arch/x86/xen/debugfs.h
+++ b/arch/x86/xen/debugfs.h
@@ -3,7 +3,7 @@
3 3
4struct dentry * __init xen_init_debugfs(void); 4struct dentry * __init xen_init_debugfs(void);
5 5
6struct dentry *xen_debugfs_create_u32_array(const char *name, mode_t mode, 6struct dentry *xen_debugfs_create_u32_array(const char *name, umode_t mode,
7 struct dentry *parent, 7 struct dentry *parent,
8 u32 *array, unsigned elements); 8 u32 *array, unsigned elements);
9 9
diff --git a/arch/xtensa/include/asm/types.h b/arch/xtensa/include/asm/types.h
index b1c981e39b52..6d4db7e8ffac 100644
--- a/arch/xtensa/include/asm/types.h
+++ b/arch/xtensa/include/asm/types.h
@@ -23,8 +23,6 @@
23 23
24#ifndef __ASSEMBLY__ 24#ifndef __ASSEMBLY__
25 25
26typedef unsigned short umode_t;
27
28/* 26/*
29 * These aren't exported outside the kernel to avoid name space clashes 27 * These aren't exported outside the kernel to avoid name space clashes
30 */ 28 */
diff --git a/block/bsg.c b/block/bsg.c
index 702f1316bb8f..9651ec7b87c2 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -1070,7 +1070,7 @@ EXPORT_SYMBOL_GPL(bsg_register_queue);
1070 1070
1071static struct cdev bsg_cdev; 1071static struct cdev bsg_cdev;
1072 1072
1073static char *bsg_devnode(struct device *dev, mode_t *mode) 1073static char *bsg_devnode(struct device *dev, umode_t *mode)
1074{ 1074{
1075 return kasprintf(GFP_KERNEL, "bsg/%s", dev_name(dev)); 1075 return kasprintf(GFP_KERNEL, "bsg/%s", dev_name(dev));
1076} 1076}
diff --git a/block/genhd.c b/block/genhd.c
index b7d1a0e42686..83e7c04015e1 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1108,7 +1108,7 @@ struct class block_class = {
1108 .name = "block", 1108 .name = "block",
1109}; 1109};
1110 1110
1111static char *block_devnode(struct device *dev, mode_t *mode) 1111static char *block_devnode(struct device *dev, umode_t *mode)
1112{ 1112{
1113 struct gendisk *disk = dev_to_disk(dev); 1113 struct gendisk *disk = dev_to_disk(dev);
1114 1114
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 7711d94a0409..86933ca8b472 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -873,7 +873,7 @@ DECLARE_FILE_FUNCTIONS(alarm);
873 873
874static const struct battery_file { 874static const struct battery_file {
875 struct file_operations ops; 875 struct file_operations ops;
876 mode_t mode; 876 umode_t mode;
877 const char *name; 877 const char *name;
878} acpi_battery_file[] = { 878} acpi_battery_file[] = {
879 FILE_DESCRIPTION_RO(info), 879 FILE_DESCRIPTION_RO(info),
diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c
index 6c47ae9793a7..b258cab9061c 100644
--- a/drivers/acpi/ec_sys.c
+++ b/drivers/acpi/ec_sys.c
@@ -105,7 +105,7 @@ int acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int ec_device_count)
105{ 105{
106 struct dentry *dev_dir; 106 struct dentry *dev_dir;
107 char name[64]; 107 char name[64];
108 mode_t mode = 0400; 108 umode_t mode = 0400;
109 109
110 if (ec_device_count == 0) { 110 if (ec_device_count == 0) {
111 acpi_ec_debugfs_dir = debugfs_create_dir("ec", NULL); 111 acpi_ec_debugfs_dir = debugfs_create_dir("ec", NULL);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 919daa7cd5b1..1dfa1d616fa5 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -198,7 +198,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,
198 if (MAJOR(dev->devt)) { 198 if (MAJOR(dev->devt)) {
199 const char *tmp; 199 const char *tmp;
200 const char *name; 200 const char *name;
201 mode_t mode = 0; 201 umode_t mode = 0;
202 202
203 add_uevent_var(env, "MAJOR=%u", MAJOR(dev->devt)); 203 add_uevent_var(env, "MAJOR=%u", MAJOR(dev->devt));
204 add_uevent_var(env, "MINOR=%u", MINOR(dev->devt)); 204 add_uevent_var(env, "MINOR=%u", MINOR(dev->devt));
@@ -1182,7 +1182,7 @@ static struct device *next_device(struct klist_iter *i)
1182 * freed by the caller. 1182 * freed by the caller.
1183 */ 1183 */
1184const char *device_get_devnode(struct device *dev, 1184const char *device_get_devnode(struct device *dev,
1185 mode_t *mode, const char **tmp) 1185 umode_t *mode, const char **tmp)
1186{ 1186{
1187 char *s; 1187 char *s;
1188 1188
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index a4760e095ff5..393f450cf43c 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -40,7 +40,7 @@ static struct req {
40 struct completion done; 40 struct completion done;
41 int err; 41 int err;
42 const char *name; 42 const char *name;
43 mode_t mode; /* 0 => delete */ 43 umode_t mode; /* 0 => delete */
44 struct device *dev; 44 struct device *dev;
45} *requests; 45} *requests;
46 46
@@ -142,7 +142,7 @@ int devtmpfs_delete_node(struct device *dev)
142 return req.err; 142 return req.err;
143} 143}
144 144
145static int dev_mkdir(const char *name, mode_t mode) 145static int dev_mkdir(const char *name, umode_t mode)
146{ 146{
147 struct dentry *dentry; 147 struct dentry *dentry;
148 struct path path; 148 struct path path;
@@ -189,7 +189,7 @@ static int create_path(const char *nodepath)
189 return err; 189 return err;
190} 190}
191 191
192static int handle_create(const char *nodename, mode_t mode, struct device *dev) 192static int handle_create(const char *nodename, umode_t mode, struct device *dev)
193{ 193{
194 struct dentry *dentry; 194 struct dentry *dentry;
195 struct path path; 195 struct path path;
@@ -378,7 +378,7 @@ int devtmpfs_mount(const char *mntdir)
378 378
379static DECLARE_COMPLETION(setup_done); 379static DECLARE_COMPLETION(setup_done);
380 380
381static int handle(const char *name, mode_t mode, struct device *dev) 381static int handle(const char *name, umode_t mode, struct device *dev)
382{ 382{
383 if (mode) 383 if (mode)
384 return handle_create(name, mode, dev); 384 return handle_create(name, mode, dev);
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
index 5f8e39c43ae5..e86d2062a164 100644
--- a/drivers/block/aoe/aoechr.c
+++ b/drivers/block/aoe/aoechr.c
@@ -270,7 +270,7 @@ static const struct file_operations aoe_fops = {
270 .llseek = noop_llseek, 270 .llseek = noop_llseek,
271}; 271};
272 272
273static char *aoe_devnode(struct device *dev, mode_t *mode) 273static char *aoe_devnode(struct device *dev, umode_t *mode)
274{ 274{
275 return kasprintf(GFP_KERNEL, "etherd/%s", dev_name(dev)); 275 return kasprintf(GFP_KERNEL, "etherd/%s", dev_name(dev));
276} 276}
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index a63b0a2b7805..d59edeabd93f 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2817,7 +2817,7 @@ static const struct block_device_operations pktcdvd_ops = {
2817 .check_events = pkt_check_events, 2817 .check_events = pkt_check_events,
2818}; 2818};
2819 2819
2820static char *pktcdvd_devnode(struct gendisk *gd, mode_t *mode) 2820static char *pktcdvd_devnode(struct gendisk *gd, umode_t *mode)
2821{ 2821{
2822 return kasprintf(GFP_KERNEL, "pktcdvd/%s", gd->disk_name); 2822 return kasprintf(GFP_KERNEL, "pktcdvd/%s", gd->disk_name);
2823} 2823}
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 145179033716..d6e9d081c8b1 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -847,7 +847,7 @@ static const struct file_operations kmsg_fops = {
847 847
848static const struct memdev { 848static const struct memdev {
849 const char *name; 849 const char *name;
850 mode_t mode; 850 umode_t mode;
851 const struct file_operations *fops; 851 const struct file_operations *fops;
852 struct backing_dev_info *dev_info; 852 struct backing_dev_info *dev_info;
853} devlist[] = { 853} devlist[] = {
@@ -901,7 +901,7 @@ static const struct file_operations memory_fops = {
901 .llseek = noop_llseek, 901 .llseek = noop_llseek,
902}; 902};
903 903
904static char *mem_devnode(struct device *dev, mode_t *mode) 904static char *mem_devnode(struct device *dev, umode_t *mode)
905{ 905{
906 if (mode && devlist[MINOR(dev->devt)].mode) 906 if (mode && devlist[MINOR(dev->devt)].mode)
907 *mode = devlist[MINOR(dev->devt)].mode; 907 *mode = devlist[MINOR(dev->devt)].mode;
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 778273c93242..522136d40843 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -258,7 +258,7 @@ int misc_deregister(struct miscdevice *misc)
258EXPORT_SYMBOL(misc_register); 258EXPORT_SYMBOL(misc_register);
259EXPORT_SYMBOL(misc_deregister); 259EXPORT_SYMBOL(misc_deregister);
260 260
261static char *misc_devnode(struct device *dev, mode_t *mode) 261static char *misc_devnode(struct device *dev, umode_t *mode)
262{ 262{
263 struct miscdevice *c = dev_get_drvdata(dev); 263 struct miscdevice *c = dev_get_drvdata(dev);
264 264
diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index b6de2c047145..54a3a6d09819 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -308,7 +308,7 @@ static const struct file_operations raw_ctl_fops = {
308 308
309static struct cdev raw_cdev; 309static struct cdev raw_cdev;
310 310
311static char *raw_devnode(struct device *dev, mode_t *mode) 311static char *raw_devnode(struct device *dev, umode_t *mode)
312{ 312{
313 return kasprintf(GFP_KERNEL, "raw/%s", dev_name(dev)); 313 return kasprintf(GFP_KERNEL, "raw/%s", dev_name(dev));
314} 314}
diff --git a/drivers/char/tile-srom.c b/drivers/char/tile-srom.c
index cf3ee008dca2..4dc019408fac 100644
--- a/drivers/char/tile-srom.c
+++ b/drivers/char/tile-srom.c
@@ -329,7 +329,7 @@ static struct device_attribute srom_dev_attrs[] = {
329 __ATTR_NULL 329 __ATTR_NULL
330}; 330};
331 331
332static char *srom_devnode(struct device *dev, mode_t *mode) 332static char *srom_devnode(struct device *dev, umode_t *mode)
333{ 333{
334 *mode = S_IRUGO | S_IWUSR; 334 *mode = S_IRUGO | S_IWUSR;
335 return kasprintf(GFP_KERNEL, "srom/%s", dev_name(dev)); 335 return kasprintf(GFP_KERNEL, "srom/%s", dev_name(dev));
diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c
index 2cce44a1d7d0..3ee852c9925b 100644
--- a/drivers/firmware/iscsi_ibft.c
+++ b/drivers/firmware/iscsi_ibft.c
@@ -433,11 +433,11 @@ static int __init ibft_check_device(void)
433 * Helper routiners to check to determine if the entry is valid 433 * Helper routiners to check to determine if the entry is valid
434 * in the proper iBFT structure. 434 * in the proper iBFT structure.
435 */ 435 */
436static mode_t ibft_check_nic_for(void *data, int type) 436static umode_t ibft_check_nic_for(void *data, int type)
437{ 437{
438 struct ibft_kobject *entry = data; 438 struct ibft_kobject *entry = data;
439 struct ibft_nic *nic = entry->nic; 439 struct ibft_nic *nic = entry->nic;
440 mode_t rc = 0; 440 umode_t rc = 0;
441 441
442 switch (type) { 442 switch (type) {
443 case ISCSI_BOOT_ETH_INDEX: 443 case ISCSI_BOOT_ETH_INDEX:
@@ -488,11 +488,11 @@ static mode_t ibft_check_nic_for(void *data, int type)
488 return rc; 488 return rc;
489} 489}
490 490
491static mode_t __init ibft_check_tgt_for(void *data, int type) 491static umode_t __init ibft_check_tgt_for(void *data, int type)
492{ 492{
493 struct ibft_kobject *entry = data; 493 struct ibft_kobject *entry = data;
494 struct ibft_tgt *tgt = entry->tgt; 494 struct ibft_tgt *tgt = entry->tgt;
495 mode_t rc = 0; 495 umode_t rc = 0;
496 496
497 switch (type) { 497 switch (type) {
498 case ISCSI_BOOT_TGT_INDEX: 498 case ISCSI_BOOT_TGT_INDEX:
@@ -524,11 +524,11 @@ static mode_t __init ibft_check_tgt_for(void *data, int type)
524 return rc; 524 return rc;
525} 525}
526 526
527static mode_t __init ibft_check_initiator_for(void *data, int type) 527static umode_t __init ibft_check_initiator_for(void *data, int type)
528{ 528{
529 struct ibft_kobject *entry = data; 529 struct ibft_kobject *entry = data;
530 struct ibft_initiator *init = entry->initiator; 530 struct ibft_initiator *init = entry->initiator;
531 mode_t rc = 0; 531 umode_t rc = 0;
532 532
533 switch (type) { 533 switch (type) {
534 case ISCSI_BOOT_INI_INDEX: 534 case ISCSI_BOOT_INI_INDEX:
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 0f9ef9bf6730..62c3675045ac 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -72,7 +72,7 @@ static int drm_class_resume(struct device *dev)
72 return 0; 72 return 0;
73} 73}
74 74
75static char *drm_devnode(struct device *dev, mode_t *mode) 75static char *drm_devnode(struct device *dev, umode_t *mode)
76{ 76{
77 return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev)); 77 return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev));
78} 78}
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 4ef02b269a71..7c297d305d5d 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -859,7 +859,7 @@ static const struct file_operations hiddev_fops = {
859 .llseek = noop_llseek, 859 .llseek = noop_llseek,
860}; 860};
861 861
862static char *hiddev_devnode(struct device *dev, mode_t *mode) 862static char *hiddev_devnode(struct device *dev, umode_t *mode)
863{ 863{
864 return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); 864 return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
865} 865}
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c
index d9c592713919..d9803958e49f 100644
--- a/drivers/hwmon/dme1737.c
+++ b/drivers/hwmon/dme1737.c
@@ -1223,7 +1223,7 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute *attr,
1223} 1223}
1224 1224
1225static struct attribute *dme1737_pwm_chmod_attr[]; 1225static struct attribute *dme1737_pwm_chmod_attr[];
1226static void dme1737_chmod_file(struct device*, struct attribute*, mode_t); 1226static void dme1737_chmod_file(struct device*, struct attribute*, umode_t);
1227 1227
1228static ssize_t set_pwm(struct device *dev, struct device_attribute *attr, 1228static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
1229 const char *buf, size_t count) 1229 const char *buf, size_t count)
@@ -1961,7 +1961,7 @@ static inline void dme1737_sio_outb(int sio_cip, int reg, int val)
1961static int dme1737_i2c_get_features(int, struct dme1737_data*); 1961static int dme1737_i2c_get_features(int, struct dme1737_data*);
1962 1962
1963static void dme1737_chmod_file(struct device *dev, 1963static void dme1737_chmod_file(struct device *dev,
1964 struct attribute *attr, mode_t mode) 1964 struct attribute *attr, umode_t mode)
1965{ 1965{
1966 if (sysfs_chmod_file(&dev->kobj, attr, mode)) { 1966 if (sysfs_chmod_file(&dev->kobj, attr, mode)) {
1967 dev_warn(dev, "Failed to change permissions of %s.\n", 1967 dev_warn(dev, "Failed to change permissions of %s.\n",
@@ -1971,7 +1971,7 @@ static void dme1737_chmod_file(struct device *dev,
1971 1971
1972static void dme1737_chmod_group(struct device *dev, 1972static void dme1737_chmod_group(struct device *dev,
1973 const struct attribute_group *group, 1973 const struct attribute_group *group,
1974 mode_t mode) 1974 umode_t mode)
1975{ 1975{
1976 struct attribute **attr; 1976 struct attribute **attr;
1977 1977
diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c
index 2d3d72805ff4..1a92951f4031 100644
--- a/drivers/hwmon/jc42.c
+++ b/drivers/hwmon/jc42.c
@@ -413,7 +413,7 @@ static struct attribute *jc42_attributes[] = {
413 NULL 413 NULL
414}; 414};
415 415
416static mode_t jc42_attribute_mode(struct kobject *kobj, 416static umode_t jc42_attribute_mode(struct kobject *kobj,
417 struct attribute *attr, int index) 417 struct attribute *attr, int index)
418{ 418{
419 struct device *dev = container_of(kobj, struct device, kobj); 419 struct device *dev = container_of(kobj, struct device, kobj);
diff --git a/drivers/hwmon/max1668.c b/drivers/hwmon/max1668.c
index 20d1b2ddffb6..6914195cfd35 100644
--- a/drivers/hwmon/max1668.c
+++ b/drivers/hwmon/max1668.c
@@ -335,10 +335,10 @@ static struct attribute *max1668_attribute_unique[] = {
335 NULL 335 NULL
336}; 336};
337 337
338static mode_t max1668_attribute_mode(struct kobject *kobj, 338static umode_t max1668_attribute_mode(struct kobject *kobj,
339 struct attribute *attr, int index) 339 struct attribute *attr, int index)
340{ 340{
341 int ret = S_IRUGO; 341 umode_t ret = S_IRUGO;
342 if (read_only) 342 if (read_only)
343 return ret; 343 return ret;
344 if (attr == &sensor_dev_attr_temp1_max.dev_attr.attr || 344 if (attr == &sensor_dev_attr_temp1_max.dev_attr.attr ||
diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c
index ece3aafa54b3..2fc034aeca09 100644
--- a/drivers/hwmon/max6650.c
+++ b/drivers/hwmon/max6650.c
@@ -464,7 +464,7 @@ static SENSOR_DEVICE_ATTR(gpio1_alarm, S_IRUGO, get_alarm, NULL,
464static SENSOR_DEVICE_ATTR(gpio2_alarm, S_IRUGO, get_alarm, NULL, 464static SENSOR_DEVICE_ATTR(gpio2_alarm, S_IRUGO, get_alarm, NULL,
465 MAX6650_ALRM_GPIO2); 465 MAX6650_ALRM_GPIO2);
466 466
467static mode_t max6650_attrs_visible(struct kobject *kobj, struct attribute *a, 467static umode_t max6650_attrs_visible(struct kobject *kobj, struct attribute *a,
468 int n) 468 int n)
469{ 469{
470 struct device *dev = container_of(kobj, struct device, kobj); 470 struct device *dev = container_of(kobj, struct device, kobj);
diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
index 0517a8f09d35..c48381f2cd02 100644
--- a/drivers/hwmon/tmp421.c
+++ b/drivers/hwmon/tmp421.c
@@ -157,7 +157,7 @@ static ssize_t show_fault(struct device *dev,
157 return sprintf(buf, "0\n"); 157 return sprintf(buf, "0\n");
158} 158}
159 159
160static mode_t tmp421_is_visible(struct kobject *kobj, struct attribute *a, 160static umode_t tmp421_is_visible(struct kobject *kobj, struct attribute *a,
161 int n) 161 int n)
162{ 162{
163 struct device *dev = container_of(kobj, struct device, kobj); 163 struct device *dev = container_of(kobj, struct device, kobj);
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 8b72f39202fb..c889aaef3416 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -3659,7 +3659,7 @@ static struct kobj_type cm_port_obj_type = {
3659 .release = cm_release_port_obj 3659 .release = cm_release_port_obj
3660}; 3660};
3661 3661
3662static char *cm_devnode(struct device *dev, mode_t *mode) 3662static char *cm_devnode(struct device *dev, umode_t *mode)
3663{ 3663{
3664 if (mode) 3664 if (mode)
3665 *mode = 0666; 3665 *mode = 0666;
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 07db22997e97..f0d588f8859e 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -1175,7 +1175,7 @@ static void ib_umad_remove_one(struct ib_device *device)
1175 kref_put(&umad_dev->ref, ib_umad_release_dev); 1175 kref_put(&umad_dev->ref, ib_umad_release_dev);
1176} 1176}
1177 1177
1178static char *umad_devnode(struct device *dev, mode_t *mode) 1178static char *umad_devnode(struct device *dev, umode_t *mode)
1179{ 1179{
1180 return kasprintf(GFP_KERNEL, "infiniband/%s", dev_name(dev)); 1180 return kasprintf(GFP_KERNEL, "infiniband/%s", dev_name(dev));
1181} 1181}
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index 879636746373..604556d73d25 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -846,7 +846,7 @@ static void ib_uverbs_remove_one(struct ib_device *device)
846 kfree(uverbs_dev); 846 kfree(uverbs_dev);
847} 847}
848 848
849static char *uverbs_devnode(struct device *dev, mode_t *mode) 849static char *uverbs_devnode(struct device *dev, umode_t *mode)
850{ 850{
851 if (mode) 851 if (mode)
852 *mode = 0666; 852 *mode = 0666;
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index 31ae1b108aea..b7d4216db3c3 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -46,7 +46,7 @@
46static struct super_block *ipath_super; 46static struct super_block *ipath_super;
47 47
48static int ipathfs_mknod(struct inode *dir, struct dentry *dentry, 48static int ipathfs_mknod(struct inode *dir, struct dentry *dentry,
49 int mode, const struct file_operations *fops, 49 umode_t mode, const struct file_operations *fops,
50 void *data) 50 void *data)
51{ 51{
52 int error; 52 int error;
@@ -61,7 +61,7 @@ static int ipathfs_mknod(struct inode *dir, struct dentry *dentry,
61 inode->i_mode = mode; 61 inode->i_mode = mode;
62 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 62 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
63 inode->i_private = data; 63 inode->i_private = data;
64 if ((mode & S_IFMT) == S_IFDIR) { 64 if (S_ISDIR(mode)) {
65 inode->i_op = &simple_dir_inode_operations; 65 inode->i_op = &simple_dir_inode_operations;
66 inc_nlink(inode); 66 inc_nlink(inode);
67 inc_nlink(dir); 67 inc_nlink(dir);
@@ -76,7 +76,7 @@ bail:
76 return error; 76 return error;
77} 77}
78 78
79static int create_file(const char *name, mode_t mode, 79static int create_file(const char *name, umode_t mode,
80 struct dentry *parent, struct dentry **dentry, 80 struct dentry *parent, struct dentry **dentry,
81 const struct file_operations *fops, void *data) 81 const struct file_operations *fops, void *data)
82{ 82{
diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c
index df7fa251dcdc..05e0f17c5b44 100644
--- a/drivers/infiniband/hw/qib/qib_fs.c
+++ b/drivers/infiniband/hw/qib/qib_fs.c
@@ -47,7 +47,7 @@ static struct super_block *qib_super;
47#define private2dd(file) ((file)->f_dentry->d_inode->i_private) 47#define private2dd(file) ((file)->f_dentry->d_inode->i_private)
48 48
49static int qibfs_mknod(struct inode *dir, struct dentry *dentry, 49static int qibfs_mknod(struct inode *dir, struct dentry *dentry,
50 int mode, const struct file_operations *fops, 50 umode_t mode, const struct file_operations *fops,
51 void *data) 51 void *data)
52{ 52{
53 int error; 53 int error;
@@ -67,7 +67,7 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry,
67 inode->i_mtime = inode->i_atime; 67 inode->i_mtime = inode->i_atime;
68 inode->i_ctime = inode->i_atime; 68 inode->i_ctime = inode->i_atime;
69 inode->i_private = data; 69 inode->i_private = data;
70 if ((mode & S_IFMT) == S_IFDIR) { 70 if (S_ISDIR(mode)) {
71 inode->i_op = &simple_dir_inode_operations; 71 inode->i_op = &simple_dir_inode_operations;
72 inc_nlink(inode); 72 inc_nlink(inode);
73 inc_nlink(dir); 73 inc_nlink(dir);
@@ -82,7 +82,7 @@ bail:
82 return error; 82 return error;
83} 83}
84 84
85static int create_file(const char *name, mode_t mode, 85static int create_file(const char *name, umode_t mode,
86 struct dentry *parent, struct dentry **dentry, 86 struct dentry *parent, struct dentry **dentry,
87 const struct file_operations *fops, void *data) 87 const struct file_operations *fops, void *data)
88{ 88{
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 7e7373a700e6..9a43cb07f294 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -638,7 +638,7 @@ iscsi_iser_ep_disconnect(struct iscsi_endpoint *ep)
638 iser_conn_terminate(ib_conn); 638 iser_conn_terminate(ib_conn);
639} 639}
640 640
641static mode_t iser_attr_is_visible(int param_type, int param) 641static umode_t iser_attr_is_visible(int param_type, int param)
642{ 642{
643 switch (param_type) { 643 switch (param_type) {
644 case ISCSI_HOST_PARAM: 644 case ISCSI_HOST_PARAM:
diff --git a/drivers/input/input.c b/drivers/input/input.c
index da38d97a51b1..1f78c957a75a 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1624,7 +1624,7 @@ static struct device_type input_dev_type = {
1624#endif 1624#endif
1625}; 1625};
1626 1626
1627static char *input_devnode(struct device *dev, mode_t *mode) 1627static char *input_devnode(struct device *dev, umode_t *mode)
1628{ 1628{
1629 return kasprintf(GFP_KERNEL, "input/%s", dev_name(dev)); 1629 return kasprintf(GFP_KERNEL, "input/%s", dev_name(dev));
1630} 1630}
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index 400131df677b..baa43df6502d 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -612,10 +612,10 @@ static struct attribute *ad7877_attributes[] = {
612 NULL 612 NULL
613}; 613};
614 614
615static mode_t ad7877_attr_is_visible(struct kobject *kobj, 615static umode_t ad7877_attr_is_visible(struct kobject *kobj,
616 struct attribute *attr, int n) 616 struct attribute *attr, int n)
617{ 617{
618 mode_t mode = attr->mode; 618 umode_t mode = attr->mode;
619 619
620 if (attr == &dev_attr_aux3.attr) { 620 if (attr == &dev_attr_aux3.attr) {
621 if (gpio3) 621 if (gpio3)
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
index cbf0ff322676..067d95662997 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -450,13 +450,13 @@ static struct attribute *tsc2005_attrs[] = {
450 NULL 450 NULL
451}; 451};
452 452
453static mode_t tsc2005_attr_is_visible(struct kobject *kobj, 453static umode_t tsc2005_attr_is_visible(struct kobject *kobj,
454 struct attribute *attr, int n) 454 struct attribute *attr, int n)
455{ 455{
456 struct device *dev = container_of(kobj, struct device, kobj); 456 struct device *dev = container_of(kobj, struct device, kobj);
457 struct spi_device *spi = to_spi_device(dev); 457 struct spi_device *spi = to_spi_device(dev);
458 struct tsc2005 *ts = spi_get_drvdata(spi); 458 struct tsc2005 *ts = spi_get_drvdata(spi);
459 mode_t mode = attr->mode; 459 umode_t mode = attr->mode;
460 460
461 if (attr == &dev_attr_selftest.attr) { 461 if (attr == &dev_attr_selftest.attr) {
462 if (!ts->set_reset) 462 if (!ts->set_reset)
diff --git a/drivers/media/dvb/ddbridge/ddbridge-core.c b/drivers/media/dvb/ddbridge/ddbridge-core.c
index ba9a643b9c6a..d1e91bc80e78 100644
--- a/drivers/media/dvb/ddbridge/ddbridge-core.c
+++ b/drivers/media/dvb/ddbridge/ddbridge-core.c
@@ -1480,7 +1480,7 @@ static const struct file_operations ddb_fops = {
1480 .open = ddb_open, 1480 .open = ddb_open,
1481}; 1481};
1482 1482
1483static char *ddb_devnode(struct device *device, mode_t *mode) 1483static char *ddb_devnode(struct device *device, umode_t *mode)
1484{ 1484{
1485 struct ddb *dev = dev_get_drvdata(device); 1485 struct ddb *dev = dev_get_drvdata(device);
1486 1486
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index f73287775953..00a67326c193 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -450,7 +450,7 @@ static int dvb_uevent(struct device *dev, struct kobj_uevent_env *env)
450 return 0; 450 return 0;
451} 451}
452 452
453static char *dvb_devnode(struct device *dev, mode_t *mode) 453static char *dvb_devnode(struct device *dev, umode_t *mode)
454{ 454{
455 struct dvb_device *dvbdev = dev_get_drvdata(dev); 455 struct dvb_device *dvbdev = dev_get_drvdata(dev);
456 456
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 29f900065d8a..f5db8b949bc3 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -715,7 +715,7 @@ static void ir_close(struct input_dev *idev)
715} 715}
716 716
717/* class for /sys/class/rc */ 717/* class for /sys/class/rc */
718static char *ir_devnode(struct device *dev, mode_t *mode) 718static char *ir_devnode(struct device *dev, umode_t *mode)
719{ 719{
720 return kasprintf(GFP_KERNEL, "rc/%s", dev_name(dev)); 720 return kasprintf(GFP_KERNEL, "rc/%s", dev_name(dev));
721} 721}
diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
index 07dbeaf9df99..6d115c7208ab 100644
--- a/drivers/message/i2o/i2o_proc.c
+++ b/drivers/message/i2o/i2o_proc.c
@@ -56,7 +56,7 @@
56/* Structure used to define /proc entries */ 56/* Structure used to define /proc entries */
57typedef struct _i2o_proc_entry_t { 57typedef struct _i2o_proc_entry_t {
58 char *name; /* entry name */ 58 char *name; /* entry name */
59 mode_t mode; /* mode */ 59 umode_t mode; /* mode */
60 const struct file_operations *fops; /* open function */ 60 const struct file_operations *fops; /* open function */
61} i2o_proc_entry; 61} i2o_proc_entry;
62 62
diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c
index 7768b87d995b..950dbe9ecb36 100644
--- a/drivers/misc/sgi-gru/gruprocfs.c
+++ b/drivers/misc/sgi-gru/gruprocfs.c
@@ -324,7 +324,7 @@ static const struct file_operations gru_fops = {
324 324
325static struct proc_entry { 325static struct proc_entry {
326 char *name; 326 char *name;
327 int mode; 327 umode_t mode;
328 const struct file_operations *fops; 328 const struct file_operations *fops;
329 struct proc_dir_entry *entry; 329 struct proc_dir_entry *entry;
330} proc_files[] = { 330} proc_files[] = {
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index b038c4a9468b..e99bdc18002d 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -2949,7 +2949,7 @@ static void mmc_test_free_dbgfs_file(struct mmc_card *card)
2949} 2949}
2950 2950
2951static int __mmc_test_register_dbgfs_file(struct mmc_card *card, 2951static int __mmc_test_register_dbgfs_file(struct mmc_card *card,
2952 const char *name, mode_t mode, const struct file_operations *fops) 2952 const char *name, umode_t mode, const struct file_operations *fops)
2953{ 2953{
2954 struct dentry *file = NULL; 2954 struct dentry *file = NULL;
2955 struct mmc_test_dbgfs_file *df; 2955 struct mmc_test_dbgfs_file *df;
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
index da9072bfca8b..f5a24d99ef4f 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
@@ -2000,7 +2000,7 @@ static const struct file_operations interfaces_proc_fops = {
2000 */ 2000 */
2001struct cxgb4vf_debugfs_entry { 2001struct cxgb4vf_debugfs_entry {
2002 const char *name; /* name of debugfs node */ 2002 const char *name; /* name of debugfs node */
2003 mode_t mode; /* file system mode */ 2003 umode_t mode; /* file system mode */
2004 const struct file_operations *fops; 2004 const struct file_operations *fops;
2005}; 2005};
2006 2006
diff --git a/drivers/net/wireless/ath/carl9170/debug.c b/drivers/net/wireless/ath/carl9170/debug.c
index de57f90e1d5f..3c164226687f 100644
--- a/drivers/net/wireless/ath/carl9170/debug.c
+++ b/drivers/net/wireless/ath/carl9170/debug.c
@@ -56,7 +56,7 @@ static int carl9170_debugfs_open(struct inode *inode, struct file *file)
56 56
57struct carl9170_debugfs_fops { 57struct carl9170_debugfs_fops {
58 unsigned int read_bufsize; 58 unsigned int read_bufsize;
59 mode_t attr; 59 umode_t attr;
60 char *(*read)(struct ar9170 *ar, char *buf, size_t bufsize, 60 char *(*read)(struct ar9170 *ar, char *buf, size_t bufsize,
61 ssize_t *len); 61 ssize_t *len);
62 ssize_t (*write)(struct ar9170 *aru, const char *buf, size_t size); 62 ssize_t (*write)(struct ar9170 *aru, const char *buf, size_t size);
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index d8d8f0d0899f..c192671610fc 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -704,7 +704,7 @@ out_unlock:
704 704
705struct lbs_debugfs_files { 705struct lbs_debugfs_files {
706 const char *name; 706 const char *name;
707 int perm; 707 umode_t perm;
708 struct file_operations fops; 708 struct file_operations fops;
709}; 709};
710 710
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
index 81525ae5d869..edaed6f4da6c 100644
--- a/drivers/pci/pci-label.c
+++ b/drivers/pci/pci-label.c
@@ -89,7 +89,7 @@ find_smbios_instance_string(struct pci_dev *pdev, char *buf,
89 return 0; 89 return 0;
90} 90}
91 91
92static mode_t 92static umode_t
93smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr, 93smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr,
94 int n) 94 int n)
95{ 95{
@@ -275,7 +275,7 @@ device_has_dsm(struct device *dev)
275 return FALSE; 275 return FALSE;
276} 276}
277 277
278static mode_t 278static umode_t
279acpi_index_string_exist(struct kobject *kobj, struct attribute *attr, int n) 279acpi_index_string_exist(struct kobject *kobj, struct attribute *attr, int n)
280{ 280{
281 struct device *dev; 281 struct device *dev;
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index edaccad9b5bf..b7944f903886 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -1477,7 +1477,7 @@ static struct attribute *asus_attributes[] = {
1477 NULL 1477 NULL
1478}; 1478};
1479 1479
1480static mode_t asus_sysfs_is_visible(struct kobject *kobj, 1480static umode_t asus_sysfs_is_visible(struct kobject *kobj,
1481 struct attribute *attr, 1481 struct attribute *attr,
1482 int idx) 1482 int idx)
1483{ 1483{
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index d1049ee3c9e8..72d731c21d45 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -992,7 +992,7 @@ static struct attribute *hwmon_attributes[] = {
992 NULL 992 NULL
993}; 993};
994 994
995static mode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj, 995static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
996 struct attribute *attr, int idx) 996 struct attribute *attr, int idx)
997{ 997{
998 struct device *dev = container_of(kobj, struct device, kobj); 998 struct device *dev = container_of(kobj, struct device, kobj);
@@ -1357,7 +1357,7 @@ static struct attribute *platform_attributes[] = {
1357 NULL 1357 NULL
1358}; 1358};
1359 1359
1360static mode_t asus_sysfs_is_visible(struct kobject *kobj, 1360static umode_t asus_sysfs_is_visible(struct kobject *kobj,
1361 struct attribute *attr, int idx) 1361 struct attribute *attr, int idx)
1362{ 1362{
1363 struct device *dev = container_of(kobj, struct device, kobj); 1363 struct device *dev = container_of(kobj, struct device, kobj);
diff --git a/drivers/platform/x86/asus_acpi.c b/drivers/platform/x86/asus_acpi.c
index d9312b3073e5..6f966d6c062b 100644
--- a/drivers/platform/x86/asus_acpi.c
+++ b/drivers/platform/x86/asus_acpi.c
@@ -1053,7 +1053,7 @@ static const struct file_operations disp_proc_fops = {
1053}; 1053};
1054 1054
1055static int 1055static int
1056asus_proc_add(char *name, const struct file_operations *proc_fops, mode_t mode, 1056asus_proc_add(char *name, const struct file_operations *proc_fops, umode_t mode,
1057 struct acpi_device *device) 1057 struct acpi_device *device)
1058{ 1058{
1059 struct proc_dir_entry *proc; 1059 struct proc_dir_entry *proc;
@@ -1072,7 +1072,7 @@ asus_proc_add(char *name, const struct file_operations *proc_fops, mode_t mode,
1072static int asus_hotk_add_fs(struct acpi_device *device) 1072static int asus_hotk_add_fs(struct acpi_device *device)
1073{ 1073{
1074 struct proc_dir_entry *proc; 1074 struct proc_dir_entry *proc;
1075 mode_t mode; 1075 umode_t mode;
1076 1076
1077 if ((asus_uid == 0) && (asus_gid == 0)) { 1077 if ((asus_uid == 0) && (asus_gid == 0)) {
1078 mode = S_IFREG | S_IRUGO | S_IWUSR | S_IWGRP; 1078 mode = S_IFREG | S_IRUGO | S_IWUSR | S_IWGRP;
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index a36addf106a0..ac902f7a9baa 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -368,7 +368,7 @@ static struct attribute *ideapad_attributes[] = {
368 NULL 368 NULL
369}; 369};
370 370
371static mode_t ideapad_is_visible(struct kobject *kobj, 371static umode_t ideapad_is_visible(struct kobject *kobj,
372 struct attribute *attr, 372 struct attribute *attr,
373 int idx) 373 int idx)
374{ 374{
diff --git a/drivers/platform/x86/intel_menlow.c b/drivers/platform/x86/intel_menlow.c
index abddc83e9fd7..3271ac85115e 100644
--- a/drivers/platform/x86/intel_menlow.c
+++ b/drivers/platform/x86/intel_menlow.c
@@ -389,7 +389,7 @@ static ssize_t bios_enabled_show(struct device *dev,
389 return sprintf(buf, "%s\n", bios_enabled ? "enabled" : "disabled"); 389 return sprintf(buf, "%s\n", bios_enabled ? "enabled" : "disabled");
390} 390}
391 391
392static int intel_menlow_add_one_attribute(char *name, int mode, void *show, 392static int intel_menlow_add_one_attribute(char *name, umode_t mode, void *show,
393 void *store, struct device *dev, 393 void *store, struct device *dev,
394 acpi_handle handle) 394 acpi_handle handle)
395{ 395{
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 7b828680b21d..455e1522253e 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -297,7 +297,7 @@ struct ibm_init_struct {
297 char param[32]; 297 char param[32];
298 298
299 int (*init) (struct ibm_init_struct *); 299 int (*init) (struct ibm_init_struct *);
300 mode_t base_procfs_mode; 300 umode_t base_procfs_mode;
301 struct ibm_struct *data; 301 struct ibm_struct *data;
302}; 302};
303 303
@@ -8542,7 +8542,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm)
8542 "%s installed\n", ibm->name); 8542 "%s installed\n", ibm->name);
8543 8543
8544 if (ibm->read) { 8544 if (ibm->read) {
8545 mode_t mode = iibm->base_procfs_mode; 8545 umode_t mode = iibm->base_procfs_mode;
8546 8546
8547 if (!mode) 8547 if (!mode)
8548 mode = S_IRUGO; 8548 mode = S_IRUGO;
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
index e15d4c9d3988..e95cd657dac2 100644
--- a/drivers/power/power_supply_sysfs.c
+++ b/drivers/power/power_supply_sysfs.c
@@ -176,13 +176,13 @@ static struct device_attribute power_supply_attrs[] = {
176static struct attribute * 176static struct attribute *
177__power_supply_attrs[ARRAY_SIZE(power_supply_attrs) + 1]; 177__power_supply_attrs[ARRAY_SIZE(power_supply_attrs) + 1];
178 178
179static mode_t power_supply_attr_is_visible(struct kobject *kobj, 179static umode_t power_supply_attr_is_visible(struct kobject *kobj,
180 struct attribute *attr, 180 struct attribute *attr,
181 int attrno) 181 int attrno)
182{ 182{
183 struct device *dev = container_of(kobj, struct device, kobj); 183 struct device *dev = container_of(kobj, struct device, kobj);
184 struct power_supply *psy = dev_get_drvdata(dev); 184 struct power_supply *psy = dev_get_drvdata(dev);
185 mode_t mode = S_IRUSR | S_IRGRP | S_IROTH; 185 umode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
186 int i; 186 int i;
187 187
188 if (attrno == POWER_SUPPLY_PROP_TYPE) 188 if (attrno == POWER_SUPPLY_PROP_TYPE)
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 2de5b60ee8c8..eef27a197c00 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1072,7 +1072,7 @@ static const struct file_operations dasd_stats_global_fops = {
1072static void dasd_profile_init(struct dasd_profile *profile, 1072static void dasd_profile_init(struct dasd_profile *profile,
1073 struct dentry *base_dentry) 1073 struct dentry *base_dentry)
1074{ 1074{
1075 mode_t mode; 1075 umode_t mode;
1076 struct dentry *pde; 1076 struct dentry *pde;
1077 1077
1078 if (!base_dentry) 1078 if (!base_dentry)
@@ -1111,7 +1111,7 @@ static void dasd_statistics_removeroot(void)
1111 1111
1112static void dasd_statistics_createroot(void) 1112static void dasd_statistics_createroot(void)
1113{ 1113{
1114 mode_t mode; 1114 umode_t mode;
1115 struct dentry *pde; 1115 struct dentry *pde;
1116 1116
1117 dasd_debugfs_root_entry = NULL; 1117 dasd_debugfs_root_entry = NULL;
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 8b002f6db6ca..33c8f09c7ac1 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -733,7 +733,7 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
733 iscsi_destroy_endpoint(beiscsi_ep->openiscsi_ep); 733 iscsi_destroy_endpoint(beiscsi_ep->openiscsi_ep);
734} 734}
735 735
736mode_t be2iscsi_attr_is_visible(int param_type, int param) 736umode_t be2iscsi_attr_is_visible(int param_type, int param)
737{ 737{
738 switch (param_type) { 738 switch (param_type) {
739 case ISCSI_HOST_PARAM: 739 case ISCSI_HOST_PARAM:
diff --git a/drivers/scsi/be2iscsi/be_iscsi.h b/drivers/scsi/be2iscsi/be_iscsi.h
index 4a1f2e393f31..5c45be134501 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.h
+++ b/drivers/scsi/be2iscsi/be_iscsi.h
@@ -26,7 +26,7 @@
26#define BE2_IPV4 0x1 26#define BE2_IPV4 0x1
27#define BE2_IPV6 0x10 27#define BE2_IPV6 0x10
28 28
29mode_t be2iscsi_attr_is_visible(int param_type, int param); 29umode_t be2iscsi_attr_is_visible(int param_type, int param);
30 30
31void beiscsi_offload_connection(struct beiscsi_conn *beiscsi_conn, 31void beiscsi_offload_connection(struct beiscsi_conn *beiscsi_conn,
32 struct beiscsi_offload_params *params); 32 struct beiscsi_offload_params *params);
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 379c696dac19..797a43994b55 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -325,9 +325,9 @@ static ssize_t beiscsi_show_boot_eth_info(void *data, int type, char *buf)
325} 325}
326 326
327 327
328static mode_t beiscsi_tgt_get_attr_visibility(void *data, int type) 328static umode_t beiscsi_tgt_get_attr_visibility(void *data, int type)
329{ 329{
330 int rc; 330 umode_t rc;
331 331
332 switch (type) { 332 switch (type) {
333 case ISCSI_BOOT_TGT_NAME: 333 case ISCSI_BOOT_TGT_NAME:
@@ -348,9 +348,9 @@ static mode_t beiscsi_tgt_get_attr_visibility(void *data, int type)
348 return rc; 348 return rc;
349} 349}
350 350
351static mode_t beiscsi_ini_get_attr_visibility(void *data, int type) 351static umode_t beiscsi_ini_get_attr_visibility(void *data, int type)
352{ 352{
353 int rc; 353 umode_t rc;
354 354
355 switch (type) { 355 switch (type) {
356 case ISCSI_BOOT_INI_INITIATOR_NAME: 356 case ISCSI_BOOT_INI_INITIATOR_NAME:
@@ -364,9 +364,9 @@ static mode_t beiscsi_ini_get_attr_visibility(void *data, int type)
364} 364}
365 365
366 366
367static mode_t beiscsi_eth_get_attr_visibility(void *data, int type) 367static umode_t beiscsi_eth_get_attr_visibility(void *data, int type)
368{ 368{
369 int rc; 369 umode_t rc;
370 370
371 switch (type) { 371 switch (type) {
372 case ISCSI_BOOT_ETH_FLAGS: 372 case ISCSI_BOOT_ETH_FLAGS:
diff --git a/drivers/scsi/bfa/bfad_debugfs.c b/drivers/scsi/bfa/bfad_debugfs.c
index dee1a094c2c2..caca9b7c8309 100644
--- a/drivers/scsi/bfa/bfad_debugfs.c
+++ b/drivers/scsi/bfa/bfad_debugfs.c
@@ -472,7 +472,7 @@ static const struct file_operations bfad_debugfs_op_regwr = {
472 472
473struct bfad_debugfs_entry { 473struct bfad_debugfs_entry {
474 const char *name; 474 const char *name;
475 mode_t mode; 475 umode_t mode;
476 const struct file_operations *fops; 476 const struct file_operations *fops;
477}; 477};
478 478
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index d1e697190970..1a44b45e7bef 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -2177,7 +2177,7 @@ static int bnx2i_nl_set_path(struct Scsi_Host *shost, struct iscsi_path *params)
2177 return 0; 2177 return 0;
2178} 2178}
2179 2179
2180static mode_t bnx2i_attr_is_visible(int param_type, int param) 2180static umode_t bnx2i_attr_is_visible(int param_type, int param)
2181{ 2181{
2182 switch (param_type) { 2182 switch (param_type) {
2183 case ISCSI_HOST_PARAM: 2183 case ISCSI_HOST_PARAM:
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index c10f74a566f2..997fa36999be 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -2569,7 +2569,7 @@ void cxgbi_iscsi_cleanup(struct iscsi_transport *itp,
2569} 2569}
2570EXPORT_SYMBOL_GPL(cxgbi_iscsi_cleanup); 2570EXPORT_SYMBOL_GPL(cxgbi_iscsi_cleanup);
2571 2571
2572mode_t cxgbi_attr_is_visible(int param_type, int param) 2572umode_t cxgbi_attr_is_visible(int param_type, int param)
2573{ 2573{
2574 switch (param_type) { 2574 switch (param_type) {
2575 case ISCSI_HOST_PARAM: 2575 case ISCSI_HOST_PARAM:
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h
index 20c88279c7a6..80fa99b3d384 100644
--- a/drivers/scsi/cxgbi/libcxgbi.h
+++ b/drivers/scsi/cxgbi/libcxgbi.h
@@ -709,7 +709,7 @@ int cxgbi_conn_xmit_pdu(struct iscsi_task *);
709 709
710void cxgbi_cleanup_task(struct iscsi_task *task); 710void cxgbi_cleanup_task(struct iscsi_task *task);
711 711
712mode_t cxgbi_attr_is_visible(int param_type, int param); 712umode_t cxgbi_attr_is_visible(int param_type, int param);
713void cxgbi_get_conn_stats(struct iscsi_cls_conn *, struct iscsi_stats *); 713void cxgbi_get_conn_stats(struct iscsi_cls_conn *, struct iscsi_stats *);
714int cxgbi_set_conn_param(struct iscsi_cls_conn *, 714int cxgbi_set_conn_param(struct iscsi_cls_conn *,
715 enum iscsi_param, char *, int); 715 enum iscsi_param, char *, int);
diff --git a/drivers/scsi/iscsi_boot_sysfs.c b/drivers/scsi/iscsi_boot_sysfs.c
index 89700cbca16e..14c1c8f6a95e 100644
--- a/drivers/scsi/iscsi_boot_sysfs.c
+++ b/drivers/scsi/iscsi_boot_sysfs.c
@@ -112,7 +112,7 @@ static struct attribute *target_attrs[] = {
112 NULL 112 NULL
113}; 113};
114 114
115static mode_t iscsi_boot_tgt_attr_is_visible(struct kobject *kobj, 115static umode_t iscsi_boot_tgt_attr_is_visible(struct kobject *kobj,
116 struct attribute *attr, int i) 116 struct attribute *attr, int i)
117{ 117{
118 struct iscsi_boot_kobj *boot_kobj = 118 struct iscsi_boot_kobj *boot_kobj =
@@ -193,7 +193,7 @@ static struct attribute *ethernet_attrs[] = {
193 NULL 193 NULL
194}; 194};
195 195
196static mode_t iscsi_boot_eth_attr_is_visible(struct kobject *kobj, 196static umode_t iscsi_boot_eth_attr_is_visible(struct kobject *kobj,
197 struct attribute *attr, int i) 197 struct attribute *attr, int i)
198{ 198{
199 struct iscsi_boot_kobj *boot_kobj = 199 struct iscsi_boot_kobj *boot_kobj =
@@ -265,7 +265,7 @@ static struct attribute *initiator_attrs[] = {
265 NULL 265 NULL
266}; 266};
267 267
268static mode_t iscsi_boot_ini_attr_is_visible(struct kobject *kobj, 268static umode_t iscsi_boot_ini_attr_is_visible(struct kobject *kobj,
269 struct attribute *attr, int i) 269 struct attribute *attr, int i)
270{ 270{
271 struct iscsi_boot_kobj *boot_kobj = 271 struct iscsi_boot_kobj *boot_kobj =
@@ -306,7 +306,7 @@ iscsi_boot_create_kobj(struct iscsi_boot_kset *boot_kset,
306 struct attribute_group *attr_group, 306 struct attribute_group *attr_group,
307 const char *name, int index, void *data, 307 const char *name, int index, void *data,
308 ssize_t (*show) (void *data, int type, char *buf), 308 ssize_t (*show) (void *data, int type, char *buf),
309 mode_t (*is_visible) (void *data, int type), 309 umode_t (*is_visible) (void *data, int type),
310 void (*release) (void *data)) 310 void (*release) (void *data))
311{ 311{
312 struct iscsi_boot_kobj *boot_kobj; 312 struct iscsi_boot_kobj *boot_kobj;
@@ -369,7 +369,7 @@ struct iscsi_boot_kobj *
369iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index, 369iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index,
370 void *data, 370 void *data,
371 ssize_t (*show) (void *data, int type, char *buf), 371 ssize_t (*show) (void *data, int type, char *buf),
372 mode_t (*is_visible) (void *data, int type), 372 umode_t (*is_visible) (void *data, int type),
373 void (*release) (void *data)) 373 void (*release) (void *data))
374{ 374{
375 return iscsi_boot_create_kobj(boot_kset, &iscsi_boot_target_attr_group, 375 return iscsi_boot_create_kobj(boot_kset, &iscsi_boot_target_attr_group,
@@ -394,7 +394,7 @@ struct iscsi_boot_kobj *
394iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index, 394iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index,
395 void *data, 395 void *data,
396 ssize_t (*show) (void *data, int type, char *buf), 396 ssize_t (*show) (void *data, int type, char *buf),
397 mode_t (*is_visible) (void *data, int type), 397 umode_t (*is_visible) (void *data, int type),
398 void (*release) (void *data)) 398 void (*release) (void *data))
399{ 399{
400 return iscsi_boot_create_kobj(boot_kset, 400 return iscsi_boot_create_kobj(boot_kset,
@@ -420,7 +420,7 @@ struct iscsi_boot_kobj *
420iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index, 420iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index,
421 void *data, 421 void *data,
422 ssize_t (*show) (void *data, int type, char *buf), 422 ssize_t (*show) (void *data, int type, char *buf),
423 mode_t (*is_visible) (void *data, int type), 423 umode_t (*is_visible) (void *data, int type),
424 void (*release) (void *data)) 424 void (*release) (void *data))
425{ 425{
426 return iscsi_boot_create_kobj(boot_kset, 426 return iscsi_boot_create_kobj(boot_kset,
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 7c34d8e7cc75..db47158e0dde 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -873,7 +873,7 @@ static void iscsi_sw_tcp_session_destroy(struct iscsi_cls_session *cls_session)
873 iscsi_host_free(shost); 873 iscsi_host_free(shost);
874} 874}
875 875
876static mode_t iscsi_sw_tcp_attr_is_visible(int param_type, int param) 876static umode_t iscsi_sw_tcp_attr_is_visible(int param_type, int param)
877{ 877{
878 switch (param_type) { 878 switch (param_type) {
879 case ISCSI_HOST_PARAM: 879 case ISCSI_HOST_PARAM:
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 4169c8baa112..78bf700b365f 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -128,7 +128,7 @@ static int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd);
128static int qla4xxx_slave_alloc(struct scsi_device *device); 128static int qla4xxx_slave_alloc(struct scsi_device *device);
129static int qla4xxx_slave_configure(struct scsi_device *device); 129static int qla4xxx_slave_configure(struct scsi_device *device);
130static void qla4xxx_slave_destroy(struct scsi_device *sdev); 130static void qla4xxx_slave_destroy(struct scsi_device *sdev);
131static mode_t ql4_attr_is_visible(int param_type, int param); 131static umode_t ql4_attr_is_visible(int param_type, int param);
132static int qla4xxx_host_reset(struct Scsi_Host *shost, int reset_type); 132static int qla4xxx_host_reset(struct Scsi_Host *shost, int reset_type);
133 133
134static struct qla4_8xxx_legacy_intr_set legacy_intr[] = 134static struct qla4_8xxx_legacy_intr_set legacy_intr[] =
@@ -197,7 +197,7 @@ static struct iscsi_transport qla4xxx_iscsi_transport = {
197 197
198static struct scsi_transport_template *qla4xxx_scsi_transport; 198static struct scsi_transport_template *qla4xxx_scsi_transport;
199 199
200static mode_t ql4_attr_is_visible(int param_type, int param) 200static umode_t ql4_attr_is_visible(int param_type, int param)
201{ 201{
202 switch (param_type) { 202 switch (param_type) {
203 case ISCSI_HOST_PARAM: 203 case ISCSI_HOST_PARAM:
@@ -3039,7 +3039,7 @@ static ssize_t qla4xxx_show_boot_eth_info(void *data, int type, char *buf)
3039 return rc; 3039 return rc;
3040} 3040}
3041 3041
3042static mode_t qla4xxx_eth_get_attr_visibility(void *data, int type) 3042static umode_t qla4xxx_eth_get_attr_visibility(void *data, int type)
3043{ 3043{
3044 int rc; 3044 int rc;
3045 3045
@@ -3073,7 +3073,7 @@ static ssize_t qla4xxx_show_boot_ini_info(void *data, int type, char *buf)
3073 return rc; 3073 return rc;
3074} 3074}
3075 3075
3076static mode_t qla4xxx_ini_get_attr_visibility(void *data, int type) 3076static umode_t qla4xxx_ini_get_attr_visibility(void *data, int type)
3077{ 3077{
3078 int rc; 3078 int rc;
3079 3079
@@ -3160,7 +3160,7 @@ static ssize_t qla4xxx_show_boot_tgt_sec_info(void *data, int type, char *buf)
3160 return qla4xxx_show_boot_tgt_info(boot_sess, type, buf); 3160 return qla4xxx_show_boot_tgt_info(boot_sess, type, buf);
3161} 3161}
3162 3162
3163static mode_t qla4xxx_tgt_get_attr_visibility(void *data, int type) 3163static umode_t qla4xxx_tgt_get_attr_visibility(void *data, int type)
3164{ 3164{
3165 int rc; 3165 int rc;
3166 3166
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 96029e6d027f..e8447fbc31f3 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -328,7 +328,7 @@ iscsi_iface_net_attr(iface, vlan_enabled, ISCSI_NET_PARAM_VLAN_ENABLED);
328iscsi_iface_net_attr(iface, mtu, ISCSI_NET_PARAM_MTU); 328iscsi_iface_net_attr(iface, mtu, ISCSI_NET_PARAM_MTU);
329iscsi_iface_net_attr(iface, port, ISCSI_NET_PARAM_PORT); 329iscsi_iface_net_attr(iface, port, ISCSI_NET_PARAM_PORT);
330 330
331static mode_t iscsi_iface_attr_is_visible(struct kobject *kobj, 331static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
332 struct attribute *attr, int i) 332 struct attribute *attr, int i)
333{ 333{
334 struct device *dev = container_of(kobj, struct device, kobj); 334 struct device *dev = container_of(kobj, struct device, kobj);
@@ -2199,7 +2199,7 @@ static struct attribute *iscsi_conn_attrs[] = {
2199 NULL, 2199 NULL,
2200}; 2200};
2201 2201
2202static mode_t iscsi_conn_attr_is_visible(struct kobject *kobj, 2202static umode_t iscsi_conn_attr_is_visible(struct kobject *kobj,
2203 struct attribute *attr, int i) 2203 struct attribute *attr, int i)
2204{ 2204{
2205 struct device *cdev = container_of(kobj, struct device, kobj); 2205 struct device *cdev = container_of(kobj, struct device, kobj);
@@ -2370,7 +2370,7 @@ static struct attribute *iscsi_session_attrs[] = {
2370 NULL, 2370 NULL,
2371}; 2371};
2372 2372
2373static mode_t iscsi_session_attr_is_visible(struct kobject *kobj, 2373static umode_t iscsi_session_attr_is_visible(struct kobject *kobj,
2374 struct attribute *attr, int i) 2374 struct attribute *attr, int i)
2375{ 2375{
2376 struct device *cdev = container_of(kobj, struct device, kobj); 2376 struct device *cdev = container_of(kobj, struct device, kobj);
@@ -2468,7 +2468,7 @@ static struct attribute *iscsi_host_attrs[] = {
2468 NULL, 2468 NULL,
2469}; 2469};
2470 2470
2471static mode_t iscsi_host_attr_is_visible(struct kobject *kobj, 2471static umode_t iscsi_host_attr_is_visible(struct kobject *kobj,
2472 struct attribute *attr, int i) 2472 struct attribute *attr, int i)
2473{ 2473{
2474 struct device *cdev = container_of(kobj, struct device, kobj); 2474 struct device *cdev = container_of(kobj, struct device, kobj);
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index 5fbeadd96819..a2715c31e754 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -1434,7 +1434,7 @@ static int spi_host_configure(struct transport_container *tc,
1434 (si->f->show_##name ? S_IRUGO : 0) | \ 1434 (si->f->show_##name ? S_IRUGO : 0) | \
1435 (si->f->set_##name ? S_IWUSR : 0) 1435 (si->f->set_##name ? S_IWUSR : 0)
1436 1436
1437static mode_t target_attribute_is_visible(struct kobject *kobj, 1437static umode_t target_attribute_is_visible(struct kobject *kobj,
1438 struct attribute *attr, int i) 1438 struct attribute *attr, int i)
1439{ 1439{
1440 struct device *cdev = container_of(kobj, struct device, kobj); 1440 struct device *cdev = container_of(kobj, struct device, kobj);
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 441a1c5b8974..02d99982a74d 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -2325,16 +2325,15 @@ static struct sg_proc_leaf sg_proc_leaf_arr[] = {
2325static int 2325static int
2326sg_proc_init(void) 2326sg_proc_init(void)
2327{ 2327{
2328 int k, mask;
2329 int num_leaves = ARRAY_SIZE(sg_proc_leaf_arr); 2328 int num_leaves = ARRAY_SIZE(sg_proc_leaf_arr);
2330 struct sg_proc_leaf * leaf; 2329 int k;
2331 2330
2332 sg_proc_sgp = proc_mkdir(sg_proc_sg_dirname, NULL); 2331 sg_proc_sgp = proc_mkdir(sg_proc_sg_dirname, NULL);
2333 if (!sg_proc_sgp) 2332 if (!sg_proc_sgp)
2334 return 1; 2333 return 1;
2335 for (k = 0; k < num_leaves; ++k) { 2334 for (k = 0; k < num_leaves; ++k) {
2336 leaf = &sg_proc_leaf_arr[k]; 2335 struct sg_proc_leaf *leaf = &sg_proc_leaf_arr[k];
2337 mask = leaf->fops->write ? S_IRUGO | S_IWUSR : S_IRUGO; 2336 umode_t mask = leaf->fops->write ? S_IRUGO | S_IWUSR : S_IRUGO;
2338 proc_create(leaf->name, mask, sg_proc_sgp, leaf->fops); 2337 proc_create(leaf->name, mask, sg_proc_sgp, leaf->fops);
2339 } 2338 }
2340 return 0; 2339 return 0;
diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
index 31c376b9d5eb..e7bf32461736 100644
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -838,14 +838,14 @@ static struct attribute *ad7192_attributes[] = {
838 NULL 838 NULL
839}; 839};
840 840
841static mode_t ad7192_attr_is_visible(struct kobject *kobj, 841static umode_t ad7192_attr_is_visible(struct kobject *kobj,
842 struct attribute *attr, int n) 842 struct attribute *attr, int n)
843{ 843{
844 struct device *dev = container_of(kobj, struct device, kobj); 844 struct device *dev = container_of(kobj, struct device, kobj);
845 struct iio_dev *indio_dev = dev_get_drvdata(dev); 845 struct iio_dev *indio_dev = dev_get_drvdata(dev);
846 struct ad7192_state *st = iio_priv(indio_dev); 846 struct ad7192_state *st = iio_priv(indio_dev);
847 847
848 mode_t mode = attr->mode; 848 umode_t mode = attr->mode;
849 849
850 if ((st->devid != ID_AD7195) && 850 if ((st->devid != ID_AD7195) &&
851 (attr == &iio_dev_attr_ac_excitation_en.dev_attr.attr)) 851 (attr == &iio_dev_attr_ac_excitation_en.dev_attr.attr))
diff --git a/drivers/staging/iio/adc/ad7606_core.c b/drivers/staging/iio/adc/ad7606_core.c
index 54423ab196fe..e3ecd3d2ef3a 100644
--- a/drivers/staging/iio/adc/ad7606_core.c
+++ b/drivers/staging/iio/adc/ad7606_core.c
@@ -205,14 +205,14 @@ static struct attribute *ad7606_attributes[] = {
205 NULL, 205 NULL,
206}; 206};
207 207
208static mode_t ad7606_attr_is_visible(struct kobject *kobj, 208static umode_t ad7606_attr_is_visible(struct kobject *kobj,
209 struct attribute *attr, int n) 209 struct attribute *attr, int n)
210{ 210{
211 struct device *dev = container_of(kobj, struct device, kobj); 211 struct device *dev = container_of(kobj, struct device, kobj);
212 struct iio_dev *indio_dev = dev_get_drvdata(dev); 212 struct iio_dev *indio_dev = dev_get_drvdata(dev);
213 struct ad7606_state *st = iio_priv(indio_dev); 213 struct ad7606_state *st = iio_priv(indio_dev);
214 214
215 mode_t mode = attr->mode; 215 umode_t mode = attr->mode;
216 216
217 if (!(gpio_is_valid(st->pdata->gpio_os0) && 217 if (!(gpio_is_valid(st->pdata->gpio_os0) &&
218 gpio_is_valid(st->pdata->gpio_os1) && 218 gpio_is_valid(st->pdata->gpio_os1) &&
diff --git a/drivers/staging/iio/dac/ad5446.c b/drivers/staging/iio/dac/ad5446.c
index e1c204d51d8c..dc46b6d6eaa3 100644
--- a/drivers/staging/iio/dac/ad5446.c
+++ b/drivers/staging/iio/dac/ad5446.c
@@ -197,14 +197,14 @@ static struct attribute *ad5446_attributes[] = {
197 NULL, 197 NULL,
198}; 198};
199 199
200static mode_t ad5446_attr_is_visible(struct kobject *kobj, 200static umode_t ad5446_attr_is_visible(struct kobject *kobj,
201 struct attribute *attr, int n) 201 struct attribute *attr, int n)
202{ 202{
203 struct device *dev = container_of(kobj, struct device, kobj); 203 struct device *dev = container_of(kobj, struct device, kobj);
204 struct iio_dev *indio_dev = dev_get_drvdata(dev); 204 struct iio_dev *indio_dev = dev_get_drvdata(dev);
205 struct ad5446_state *st = iio_priv(indio_dev); 205 struct ad5446_state *st = iio_priv(indio_dev);
206 206
207 mode_t mode = attr->mode; 207 umode_t mode = attr->mode;
208 208
209 if (!st->chip_info->store_pwr_down && 209 if (!st->chip_info->store_pwr_down &&
210 (attr == &iio_dev_attr_out_voltage0_powerdown.dev_attr.attr || 210 (attr == &iio_dev_attr_out_voltage0_powerdown.dev_attr.attr ||
diff --git a/drivers/staging/iio/dds/ad9834.c b/drivers/staging/iio/dds/ad9834.c
index c468f696fe25..cc3293a9f496 100644
--- a/drivers/staging/iio/dds/ad9834.c
+++ b/drivers/staging/iio/dds/ad9834.c
@@ -281,14 +281,14 @@ static struct attribute *ad9834_attributes[] = {
281 NULL, 281 NULL,
282}; 282};
283 283
284static mode_t ad9834_attr_is_visible(struct kobject *kobj, 284static umode_t ad9834_attr_is_visible(struct kobject *kobj,
285 struct attribute *attr, int n) 285 struct attribute *attr, int n)
286{ 286{
287 struct device *dev = container_of(kobj, struct device, kobj); 287 struct device *dev = container_of(kobj, struct device, kobj);
288 struct iio_dev *indio_dev = dev_get_drvdata(dev); 288 struct iio_dev *indio_dev = dev_get_drvdata(dev);
289 struct ad9834_state *st = iio_priv(indio_dev); 289 struct ad9834_state *st = iio_priv(indio_dev);
290 290
291 mode_t mode = attr->mode; 291 umode_t mode = attr->mode;
292 292
293 if (((st->devid == ID_AD9833) || (st->devid == ID_AD9837)) && 293 if (((st->devid == ID_AD9833) || (st->devid == ID_AD9837)) &&
294 ((attr == &iio_dev_attr_dds0_out1_enable.dev_attr.attr) || 294 ((attr == &iio_dev_attr_dds0_out1_enable.dev_attr.attr) ||
diff --git a/drivers/staging/pohmelfs/dir.c b/drivers/staging/pohmelfs/dir.c
index 7598e77672a5..2ee4491b7136 100644
--- a/drivers/staging/pohmelfs/dir.c
+++ b/drivers/staging/pohmelfs/dir.c
@@ -590,13 +590,13 @@ out:
590 * during writeback for given inode. 590 * during writeback for given inode.
591 */ 591 */
592struct pohmelfs_inode *pohmelfs_create_entry_local(struct pohmelfs_sb *psb, 592struct pohmelfs_inode *pohmelfs_create_entry_local(struct pohmelfs_sb *psb,
593 struct pohmelfs_inode *parent, struct qstr *str, u64 start, int mode) 593 struct pohmelfs_inode *parent, struct qstr *str, u64 start, umode_t mode)
594{ 594{
595 struct pohmelfs_inode *npi; 595 struct pohmelfs_inode *npi;
596 int err = -ENOMEM; 596 int err = -ENOMEM;
597 struct netfs_inode_info info; 597 struct netfs_inode_info info;
598 598
599 dprintk("%s: name: '%s', mode: %o, start: %llu.\n", 599 dprintk("%s: name: '%s', mode: %ho, start: %llu.\n",
600 __func__, str->name, mode, start); 600 __func__, str->name, mode, start);
601 601
602 info.mode = mode; 602 info.mode = mode;
@@ -630,7 +630,8 @@ err_out_unlock:
630/* 630/*
631 * Create local object and bind it to dentry. 631 * Create local object and bind it to dentry.
632 */ 632 */
633static int pohmelfs_create_entry(struct inode *dir, struct dentry *dentry, u64 start, int mode) 633static int pohmelfs_create_entry(struct inode *dir, struct dentry *dentry,
634 u64 start, umode_t mode)
634{ 635{
635 struct pohmelfs_sb *psb = POHMELFS_SB(dir->i_sb); 636 struct pohmelfs_sb *psb = POHMELFS_SB(dir->i_sb);
636 struct pohmelfs_inode *npi, *parent; 637 struct pohmelfs_inode *npi, *parent;
@@ -661,13 +662,13 @@ static int pohmelfs_create_entry(struct inode *dir, struct dentry *dentry, u64 s
661/* 662/*
662 * VFS create and mkdir callbacks. 663 * VFS create and mkdir callbacks.
663 */ 664 */
664static int pohmelfs_create(struct inode *dir, struct dentry *dentry, int mode, 665static int pohmelfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
665 struct nameidata *nd) 666 struct nameidata *nd)
666{ 667{
667 return pohmelfs_create_entry(dir, dentry, 0, mode); 668 return pohmelfs_create_entry(dir, dentry, 0, mode);
668} 669}
669 670
670static int pohmelfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 671static int pohmelfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
671{ 672{
672 int err; 673 int err;
673 674
diff --git a/drivers/staging/pohmelfs/netfs.h b/drivers/staging/pohmelfs/netfs.h
index 985b6b755d5d..f26894f2a57f 100644
--- a/drivers/staging/pohmelfs/netfs.h
+++ b/drivers/staging/pohmelfs/netfs.h
@@ -776,7 +776,7 @@ struct pohmelfs_name *pohmelfs_search_hash(struct pohmelfs_inode *pi, u32 hash);
776void pohmelfs_inode_del_inode(struct pohmelfs_sb *psb, struct pohmelfs_inode *pi); 776void pohmelfs_inode_del_inode(struct pohmelfs_sb *psb, struct pohmelfs_inode *pi);
777 777
778struct pohmelfs_inode *pohmelfs_create_entry_local(struct pohmelfs_sb *psb, 778struct pohmelfs_inode *pohmelfs_create_entry_local(struct pohmelfs_sb *psb,
779 struct pohmelfs_inode *parent, struct qstr *str, u64 start, int mode); 779 struct pohmelfs_inode *parent, struct qstr *str, u64 start, umode_t mode);
780 780
781int pohmelfs_write_create_inode(struct pohmelfs_inode *pi); 781int pohmelfs_write_create_inode(struct pohmelfs_inode *pi);
782 782
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 05085beb83db..3fdebd306b94 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -3267,7 +3267,7 @@ void __init console_init(void)
3267 } 3267 }
3268} 3268}
3269 3269
3270static char *tty_devnode(struct device *dev, mode_t *mode) 3270static char *tty_devnode(struct device *dev, umode_t *mode)
3271{ 3271{
3272 if (!mode) 3272 if (!mode)
3273 return NULL; 3273 return NULL;
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index cb3a93243a05..bc5089f76cec 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -1045,7 +1045,7 @@ static const struct file_operations usblp_fops = {
1045 .llseek = noop_llseek, 1045 .llseek = noop_llseek,
1046}; 1046};
1047 1047
1048static char *usblp_devnode(struct device *dev, mode_t *mode) 1048static char *usblp_devnode(struct device *dev, umode_t *mode)
1049{ 1049{
1050 return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); 1050 return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
1051} 1051}
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
index 99458c843d60..d95760de9e8b 100644
--- a/drivers/usb/core/file.c
+++ b/drivers/usb/core/file.c
@@ -66,7 +66,7 @@ static struct usb_class {
66 struct class *class; 66 struct class *class;
67} *usb_class; 67} *usb_class;
68 68
69static char *usb_devnode(struct device *dev, mode_t *mode) 69static char *usb_devnode(struct device *dev, umode_t *mode)
70{ 70{
71 struct usb_class_driver *drv; 71 struct usb_class_driver *drv;
72 72
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index 783fde7f44c8..2b60af2ce3ba 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -270,15 +270,13 @@ static int remount(struct super_block *sb, int *flags, char *data)
270 return 0; 270 return 0;
271} 271}
272 272
273static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t dev) 273static struct inode *usbfs_get_inode (struct super_block *sb, umode_t mode, dev_t dev)
274{ 274{
275 struct inode *inode = new_inode(sb); 275 struct inode *inode = new_inode(sb);
276 276
277 if (inode) { 277 if (inode) {
278 inode->i_ino = get_next_ino(); 278 inode->i_ino = get_next_ino();
279 inode->i_mode = mode; 279 inode_init_owner(inode, NULL, mode);
280 inode->i_uid = current_fsuid();
281 inode->i_gid = current_fsgid();
282 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 280 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
283 switch (mode & S_IFMT) { 281 switch (mode & S_IFMT) {
284 default: 282 default:
@@ -300,7 +298,7 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t de
300} 298}
301 299
302/* SMP-safe */ 300/* SMP-safe */
303static int usbfs_mknod (struct inode *dir, struct dentry *dentry, int mode, 301static int usbfs_mknod (struct inode *dir, struct dentry *dentry, umode_t mode,
304 dev_t dev) 302 dev_t dev)
305{ 303{
306 struct inode *inode = usbfs_get_inode(dir->i_sb, mode, dev); 304 struct inode *inode = usbfs_get_inode(dir->i_sb, mode, dev);
@@ -317,7 +315,7 @@ static int usbfs_mknod (struct inode *dir, struct dentry *dentry, int mode,
317 return error; 315 return error;
318} 316}
319 317
320static int usbfs_mkdir (struct inode *dir, struct dentry *dentry, int mode) 318static int usbfs_mkdir (struct inode *dir, struct dentry *dentry, umode_t mode)
321{ 319{
322 int res; 320 int res;
323 321
@@ -328,7 +326,7 @@ static int usbfs_mkdir (struct inode *dir, struct dentry *dentry, int mode)
328 return res; 326 return res;
329} 327}
330 328
331static int usbfs_create (struct inode *dir, struct dentry *dentry, int mode) 329static int usbfs_create (struct inode *dir, struct dentry *dentry, umode_t mode)
332{ 330{
333 mode = (mode & S_IALLUGO) | S_IFREG; 331 mode = (mode & S_IALLUGO) | S_IFREG;
334 return usbfs_mknod (dir, dentry, mode, 0); 332 return usbfs_mknod (dir, dentry, mode, 0);
@@ -489,7 +487,7 @@ static int usbfs_fill_super(struct super_block *sb, void *data, int silent)
489 * 487 *
490 * This function handles both regular files and directories. 488 * This function handles both regular files and directories.
491 */ 489 */
492static int fs_create_by_name (const char *name, mode_t mode, 490static int fs_create_by_name (const char *name, umode_t mode,
493 struct dentry *parent, struct dentry **dentry) 491 struct dentry *parent, struct dentry **dentry)
494{ 492{
495 int error = 0; 493 int error = 0;
@@ -513,7 +511,7 @@ static int fs_create_by_name (const char *name, mode_t mode,
513 mutex_lock(&parent->d_inode->i_mutex); 511 mutex_lock(&parent->d_inode->i_mutex);
514 *dentry = lookup_one_len(name, parent, strlen(name)); 512 *dentry = lookup_one_len(name, parent, strlen(name));
515 if (!IS_ERR(*dentry)) { 513 if (!IS_ERR(*dentry)) {
516 if ((mode & S_IFMT) == S_IFDIR) 514 if (S_ISDIR(mode))
517 error = usbfs_mkdir (parent->d_inode, *dentry, mode); 515 error = usbfs_mkdir (parent->d_inode, *dentry, mode);
518 else 516 else
519 error = usbfs_create (parent->d_inode, *dentry, mode); 517 error = usbfs_create (parent->d_inode, *dentry, mode);
@@ -524,7 +522,7 @@ static int fs_create_by_name (const char *name, mode_t mode,
524 return error; 522 return error;
525} 523}
526 524
527static struct dentry *fs_create_file (const char *name, mode_t mode, 525static struct dentry *fs_create_file (const char *name, umode_t mode,
528 struct dentry *parent, void *data, 526 struct dentry *parent, void *data,
529 const struct file_operations *fops, 527 const struct file_operations *fops,
530 uid_t uid, gid_t gid) 528 uid_t uid, gid_t gid)
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index 662c0cf3a3e1..9e491ca2e5c4 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -642,7 +642,7 @@ static struct attribute *dev_string_attrs[] = {
642 NULL 642 NULL
643}; 643};
644 644
645static mode_t dev_string_attrs_are_visible(struct kobject *kobj, 645static umode_t dev_string_attrs_are_visible(struct kobject *kobj,
646 struct attribute *a, int n) 646 struct attribute *a, int n)
647{ 647{
648 struct device *dev = container_of(kobj, struct device, kobj); 648 struct device *dev = container_of(kobj, struct device, kobj);
@@ -877,7 +877,7 @@ static struct attribute *intf_assoc_attrs[] = {
877 NULL, 877 NULL,
878}; 878};
879 879
880static mode_t intf_assoc_attrs_are_visible(struct kobject *kobj, 880static umode_t intf_assoc_attrs_are_visible(struct kobject *kobj,
881 struct attribute *a, int n) 881 struct attribute *a, int n)
882{ 882{
883 struct device *dev = container_of(kobj, struct device, kobj); 883 struct device *dev = container_of(kobj, struct device, kobj);
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 73cd90012ec5..1382c90d0834 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -326,7 +326,7 @@ static const struct dev_pm_ops usb_device_pm_ops = {
326#endif /* CONFIG_PM */ 326#endif /* CONFIG_PM */
327 327
328 328
329static char *usb_devnode(struct device *dev, mode_t *mode) 329static char *usb_devnode(struct device *dev, umode_t *mode)
330{ 330{
331 struct usb_device *usb_dev; 331 struct usb_device *usb_dev;
332 332
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index 81457904d6ba..5bd4b0526de5 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -734,7 +734,7 @@ static const struct file_operations iowarrior_fops = {
734 .llseek = noop_llseek, 734 .llseek = noop_llseek,
735}; 735};
736 736
737static char *iowarrior_devnode(struct device *dev, mode_t *mode) 737static char *iowarrior_devnode(struct device *dev, umode_t *mode)
738{ 738{
739 return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); 739 return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
740} 740}
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index a989356f693e..94f6566b99f8 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -269,7 +269,7 @@ static const struct file_operations tower_fops = {
269 .llseek = tower_llseek, 269 .llseek = tower_llseek,
270}; 270};
271 271
272static char *legousbtower_devnode(struct device *dev, mode_t *mode) 272static char *legousbtower_devnode(struct device *dev, umode_t *mode)
273{ 273{
274 return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); 274 return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
275} 275}
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h
index 410ffd6ceb5f..dc95a252523d 100644
--- a/fs/9p/v9fs_vfs.h
+++ b/fs/9p/v9fs_vfs.h
@@ -54,9 +54,9 @@ extern struct kmem_cache *v9fs_inode_cache;
54 54
55struct inode *v9fs_alloc_inode(struct super_block *sb); 55struct inode *v9fs_alloc_inode(struct super_block *sb);
56void v9fs_destroy_inode(struct inode *inode); 56void v9fs_destroy_inode(struct inode *inode);
57struct inode *v9fs_get_inode(struct super_block *sb, int mode, dev_t); 57struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t);
58int v9fs_init_inode(struct v9fs_session_info *v9ses, 58int v9fs_init_inode(struct v9fs_session_info *v9ses,
59 struct inode *inode, int mode, dev_t); 59 struct inode *inode, umode_t mode, dev_t);
60void v9fs_evict_inode(struct inode *inode); 60void v9fs_evict_inode(struct inode *inode);
61ino_t v9fs_qid2ino(struct p9_qid *qid); 61ino_t v9fs_qid2ino(struct p9_qid *qid);
62void v9fs_stat2inode(struct p9_wstat *, struct inode *, struct super_block *); 62void v9fs_stat2inode(struct p9_wstat *, struct inode *, struct super_block *);
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 2310cc9eb402..e0f20de6aa2b 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -59,15 +59,13 @@ static const struct inode_operations v9fs_symlink_inode_operations;
59 * 59 *
60 */ 60 */
61 61
62static int unixmode2p9mode(struct v9fs_session_info *v9ses, int mode) 62static u32 unixmode2p9mode(struct v9fs_session_info *v9ses, umode_t mode)
63{ 63{
64 int res; 64 int res;
65 res = mode & 0777; 65 res = mode & 0777;
66 if (S_ISDIR(mode)) 66 if (S_ISDIR(mode))
67 res |= P9_DMDIR; 67 res |= P9_DMDIR;
68 if (v9fs_proto_dotu(v9ses)) { 68 if (v9fs_proto_dotu(v9ses)) {
69 if (S_ISLNK(mode))
70 res |= P9_DMSYMLINK;
71 if (v9ses->nodev == 0) { 69 if (v9ses->nodev == 0) {
72 if (S_ISSOCK(mode)) 70 if (S_ISSOCK(mode))
73 res |= P9_DMSOCKET; 71 res |= P9_DMSOCKET;
@@ -85,10 +83,7 @@ static int unixmode2p9mode(struct v9fs_session_info *v9ses, int mode)
85 res |= P9_DMSETGID; 83 res |= P9_DMSETGID;
86 if ((mode & S_ISVTX) == S_ISVTX) 84 if ((mode & S_ISVTX) == S_ISVTX)
87 res |= P9_DMSETVTX; 85 res |= P9_DMSETVTX;
88 if ((mode & P9_DMLINK))
89 res |= P9_DMLINK;
90 } 86 }
91
92 return res; 87 return res;
93} 88}
94 89
@@ -99,11 +94,11 @@ static int unixmode2p9mode(struct v9fs_session_info *v9ses, int mode)
99 * @rdev: major number, minor number in case of device files. 94 * @rdev: major number, minor number in case of device files.
100 * 95 *
101 */ 96 */
102static int p9mode2unixmode(struct v9fs_session_info *v9ses, 97static umode_t p9mode2unixmode(struct v9fs_session_info *v9ses,
103 struct p9_wstat *stat, dev_t *rdev) 98 struct p9_wstat *stat, dev_t *rdev)
104{ 99{
105 int res; 100 int res;
106 int mode = stat->mode; 101 u32 mode = stat->mode;
107 102
108 res = mode & S_IALLUGO; 103 res = mode & S_IALLUGO;
109 *rdev = 0; 104 *rdev = 0;
@@ -260,7 +255,7 @@ void v9fs_destroy_inode(struct inode *inode)
260} 255}
261 256
262int v9fs_init_inode(struct v9fs_session_info *v9ses, 257int v9fs_init_inode(struct v9fs_session_info *v9ses,
263 struct inode *inode, int mode, dev_t rdev) 258 struct inode *inode, umode_t mode, dev_t rdev)
264{ 259{
265 int err = 0; 260 int err = 0;
266 261
@@ -334,7 +329,7 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
334 329
335 break; 330 break;
336 default: 331 default:
337 P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n", 332 P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%hx S_IFMT 0x%x\n",
338 mode, mode & S_IFMT); 333 mode, mode & S_IFMT);
339 err = -EINVAL; 334 err = -EINVAL;
340 goto error; 335 goto error;
@@ -351,13 +346,13 @@ error:
351 * 346 *
352 */ 347 */
353 348
354struct inode *v9fs_get_inode(struct super_block *sb, int mode, dev_t rdev) 349struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t rdev)
355{ 350{
356 int err; 351 int err;
357 struct inode *inode; 352 struct inode *inode;
358 struct v9fs_session_info *v9ses = sb->s_fs_info; 353 struct v9fs_session_info *v9ses = sb->s_fs_info;
359 354
360 P9_DPRINTK(P9_DEBUG_VFS, "super block: %p mode: %o\n", sb, mode); 355 P9_DPRINTK(P9_DEBUG_VFS, "super block: %p mode: %ho\n", sb, mode);
361 356
362 inode = new_inode(sb); 357 inode = new_inode(sb);
363 if (!inode) { 358 if (!inode) {
@@ -491,7 +486,8 @@ static struct inode *v9fs_qid_iget(struct super_block *sb,
491 int new) 486 int new)
492{ 487{
493 dev_t rdev; 488 dev_t rdev;
494 int retval, umode; 489 int retval;
490 umode_t umode;
495 unsigned long i_ino; 491 unsigned long i_ino;
496 struct inode *inode; 492 struct inode *inode;
497 struct v9fs_session_info *v9ses = sb->s_fs_info; 493 struct v9fs_session_info *v9ses = sb->s_fs_info;
@@ -702,7 +698,7 @@ error:
702 */ 698 */
703 699
704static int 700static int
705v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode, 701v9fs_vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
706 struct nameidata *nd) 702 struct nameidata *nd)
707{ 703{
708 int err; 704 int err;
@@ -785,7 +781,7 @@ error:
785 * 781 *
786 */ 782 */
787 783
788static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 784static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
789{ 785{
790 int err; 786 int err;
791 u32 perm; 787 u32 perm;
@@ -1130,7 +1126,7 @@ void
1130v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, 1126v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
1131 struct super_block *sb) 1127 struct super_block *sb)
1132{ 1128{
1133 mode_t mode; 1129 umode_t mode;
1134 char ext[32]; 1130 char ext[32];
1135 char tag_name[14]; 1131 char tag_name[14];
1136 unsigned int i_nlink; 1132 unsigned int i_nlink;
@@ -1303,9 +1299,8 @@ v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
1303 */ 1299 */
1304 1300
1305static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, 1301static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
1306 int mode, const char *extension) 1302 u32 perm, const char *extension)
1307{ 1303{
1308 u32 perm;
1309 struct p9_fid *fid; 1304 struct p9_fid *fid;
1310 struct v9fs_session_info *v9ses; 1305 struct v9fs_session_info *v9ses;
1311 1306
@@ -1315,7 +1310,6 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
1315 return -EPERM; 1310 return -EPERM;
1316 } 1311 }
1317 1312
1318 perm = unixmode2p9mode(v9ses, mode);
1319 fid = v9fs_create(v9ses, dir, dentry, (char *) extension, perm, 1313 fid = v9fs_create(v9ses, dir, dentry, (char *) extension, perm,
1320 P9_OREAD); 1314 P9_OREAD);
1321 if (IS_ERR(fid)) 1315 if (IS_ERR(fid))
@@ -1342,7 +1336,7 @@ v9fs_vfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
1342 P9_DPRINTK(P9_DEBUG_VFS, " %lu,%s,%s\n", dir->i_ino, 1336 P9_DPRINTK(P9_DEBUG_VFS, " %lu,%s,%s\n", dir->i_ino,
1343 dentry->d_name.name, symname); 1337 dentry->d_name.name, symname);
1344 1338
1345 return v9fs_vfs_mkspecial(dir, dentry, S_IFLNK, symname); 1339 return v9fs_vfs_mkspecial(dir, dentry, P9_DMSYMLINK, symname);
1346} 1340}
1347 1341
1348/** 1342/**
@@ -1397,13 +1391,15 @@ clunk_fid:
1397 */ 1391 */
1398 1392
1399static int 1393static int
1400v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) 1394v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev)
1401{ 1395{
1396 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir);
1402 int retval; 1397 int retval;
1403 char *name; 1398 char *name;
1399 u32 perm;
1404 1400
1405 P9_DPRINTK(P9_DEBUG_VFS, 1401 P9_DPRINTK(P9_DEBUG_VFS,
1406 " %lu,%s mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino, 1402 " %lu,%s mode: %hx MAJOR: %u MINOR: %u\n", dir->i_ino,
1407 dentry->d_name.name, mode, MAJOR(rdev), MINOR(rdev)); 1403 dentry->d_name.name, mode, MAJOR(rdev), MINOR(rdev));
1408 1404
1409 if (!new_valid_dev(rdev)) 1405 if (!new_valid_dev(rdev))
@@ -1426,7 +1422,8 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
1426 return -EINVAL; 1422 return -EINVAL;
1427 } 1423 }
1428 1424
1429 retval = v9fs_vfs_mkspecial(dir, dentry, mode, name); 1425 perm = unixmode2p9mode(v9ses, mode);
1426 retval = v9fs_vfs_mkspecial(dir, dentry, perm, name);
1430 __putname(name); 1427 __putname(name);
1431 1428
1432 return retval; 1429 return retval;
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 0b5745e21946..8ef152ac6a16 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -48,7 +48,7 @@
48#include "acl.h" 48#include "acl.h"
49 49
50static int 50static int
51v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode, 51v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
52 dev_t rdev); 52 dev_t rdev);
53 53
54/** 54/**
@@ -253,7 +253,7 @@ int v9fs_open_to_dotl_flags(int flags)
253 */ 253 */
254 254
255static int 255static int
256v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode, 256v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
257 struct nameidata *nd) 257 struct nameidata *nd)
258{ 258{
259 int err = 0; 259 int err = 0;
@@ -284,7 +284,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
284 284
285 name = (char *) dentry->d_name.name; 285 name = (char *) dentry->d_name.name;
286 P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x " 286 P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x "
287 "mode:0x%x\n", name, flags, omode); 287 "mode:0x%hx\n", name, flags, omode);
288 288
289 dfid = v9fs_fid_lookup(dentry->d_parent); 289 dfid = v9fs_fid_lookup(dentry->d_parent);
290 if (IS_ERR(dfid)) { 290 if (IS_ERR(dfid)) {
@@ -395,7 +395,7 @@ err_clunk_old_fid:
395 */ 395 */
396 396
397static int v9fs_vfs_mkdir_dotl(struct inode *dir, 397static int v9fs_vfs_mkdir_dotl(struct inode *dir,
398 struct dentry *dentry, int omode) 398 struct dentry *dentry, umode_t omode)
399{ 399{
400 int err; 400 int err;
401 struct v9fs_session_info *v9ses; 401 struct v9fs_session_info *v9ses;
@@ -594,7 +594,7 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
594void 594void
595v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode) 595v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode)
596{ 596{
597 mode_t mode; 597 umode_t mode;
598 struct v9fs_inode *v9inode = V9FS_I(inode); 598 struct v9fs_inode *v9inode = V9FS_I(inode);
599 599
600 if ((stat->st_result_mask & P9_STATS_BASIC) == P9_STATS_BASIC) { 600 if ((stat->st_result_mask & P9_STATS_BASIC) == P9_STATS_BASIC) {
@@ -799,7 +799,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
799 * 799 *
800 */ 800 */
801static int 801static int
802v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode, 802v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
803 dev_t rdev) 803 dev_t rdev)
804{ 804{
805 int err; 805 int err;
@@ -814,7 +814,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
814 struct posix_acl *dacl = NULL, *pacl = NULL; 814 struct posix_acl *dacl = NULL, *pacl = NULL;
815 815
816 P9_DPRINTK(P9_DEBUG_VFS, 816 P9_DPRINTK(P9_DEBUG_VFS,
817 " %lu,%s mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino, 817 " %lu,%s mode: %hx MAJOR: %u MINOR: %u\n", dir->i_ino,
818 dentry->d_name.name, omode, MAJOR(rdev), MINOR(rdev)); 818 dentry->d_name.name, omode, MAJOR(rdev), MINOR(rdev));
819 819
820 if (!new_valid_dev(rdev)) 820 if (!new_valid_dev(rdev))
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index c70251d47ed1..f68ff65a32a5 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -117,7 +117,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
117 struct inode *inode = NULL; 117 struct inode *inode = NULL;
118 struct dentry *root = NULL; 118 struct dentry *root = NULL;
119 struct v9fs_session_info *v9ses = NULL; 119 struct v9fs_session_info *v9ses = NULL;
120 int mode = S_IRWXUGO | S_ISVTX; 120 umode_t mode = S_IRWXUGO | S_ISVTX;
121 struct p9_fid *fid; 121 struct p9_fid *fid;
122 int retval = 0; 122 int retval = 0;
123 123
diff --git a/fs/Makefile b/fs/Makefile
index c36ebec298b8..93804d4d66e1 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -19,6 +19,8 @@ else
19obj-y += no-block.o 19obj-y += no-block.o
20endif 20endif
21 21
22obj-$(CONFIG_PROC_FS) += proc_namespace.o
23
22obj-$(CONFIG_BLK_DEV_INTEGRITY) += bio-integrity.o 24obj-$(CONFIG_BLK_DEV_INTEGRITY) += bio-integrity.o
23obj-y += notify/ 25obj-y += notify/
24obj-$(CONFIG_EPOLL) += eventpoll.o 26obj-$(CONFIG_EPOLL) += eventpoll.o
diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index c2b9c79eb64e..45a0ce45d7b4 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -136,7 +136,7 @@ extern int affs_remove_header(struct dentry *dentry);
136extern u32 affs_checksum_block(struct super_block *sb, struct buffer_head *bh); 136extern u32 affs_checksum_block(struct super_block *sb, struct buffer_head *bh);
137extern void affs_fix_checksum(struct super_block *sb, struct buffer_head *bh); 137extern void affs_fix_checksum(struct super_block *sb, struct buffer_head *bh);
138extern void secs_to_datestamp(time_t secs, struct affs_date *ds); 138extern void secs_to_datestamp(time_t secs, struct affs_date *ds);
139extern mode_t prot_to_mode(u32 prot); 139extern umode_t prot_to_mode(u32 prot);
140extern void mode_to_prot(struct inode *inode); 140extern void mode_to_prot(struct inode *inode);
141extern void affs_error(struct super_block *sb, const char *function, const char *fmt, ...); 141extern void affs_error(struct super_block *sb, const char *function, const char *fmt, ...);
142extern void affs_warning(struct super_block *sb, const char *function, const char *fmt, ...); 142extern void affs_warning(struct super_block *sb, const char *function, const char *fmt, ...);
@@ -156,8 +156,8 @@ extern void affs_free_bitmap(struct super_block *sb);
156extern int affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len); 156extern int affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len);
157extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *); 157extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *);
158extern int affs_unlink(struct inode *dir, struct dentry *dentry); 158extern int affs_unlink(struct inode *dir, struct dentry *dentry);
159extern int affs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *); 159extern int affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *);
160extern int affs_mkdir(struct inode *dir, struct dentry *dentry, int mode); 160extern int affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
161extern int affs_rmdir(struct inode *dir, struct dentry *dentry); 161extern int affs_rmdir(struct inode *dir, struct dentry *dentry);
162extern int affs_link(struct dentry *olddentry, struct inode *dir, 162extern int affs_link(struct dentry *olddentry, struct inode *dir,
163 struct dentry *dentry); 163 struct dentry *dentry);
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index de37ec842340..52a6407682e6 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -390,10 +390,10 @@ secs_to_datestamp(time_t secs, struct affs_date *ds)
390 ds->ticks = cpu_to_be32(secs * 50); 390 ds->ticks = cpu_to_be32(secs * 50);
391} 391}
392 392
393mode_t 393umode_t
394prot_to_mode(u32 prot) 394prot_to_mode(u32 prot)
395{ 395{
396 int mode = 0; 396 umode_t mode = 0;
397 397
398 if (!(prot & FIBF_NOWRITE)) 398 if (!(prot & FIBF_NOWRITE))
399 mode |= S_IWUSR; 399 mode |= S_IWUSR;
@@ -421,7 +421,7 @@ void
421mode_to_prot(struct inode *inode) 421mode_to_prot(struct inode *inode)
422{ 422{
423 u32 prot = AFFS_I(inode)->i_protect; 423 u32 prot = AFFS_I(inode)->i_protect;
424 mode_t mode = inode->i_mode; 424 umode_t mode = inode->i_mode;
425 425
426 if (!(mode & S_IXUSR)) 426 if (!(mode & S_IXUSR))
427 prot |= FIBF_NOEXECUTE; 427 prot |= FIBF_NOEXECUTE;
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index 780a11dc6318..47806940aac0 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -255,13 +255,13 @@ affs_unlink(struct inode *dir, struct dentry *dentry)
255} 255}
256 256
257int 257int
258affs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) 258affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd)
259{ 259{
260 struct super_block *sb = dir->i_sb; 260 struct super_block *sb = dir->i_sb;
261 struct inode *inode; 261 struct inode *inode;
262 int error; 262 int error;
263 263
264 pr_debug("AFFS: create(%lu,\"%.*s\",0%o)\n",dir->i_ino,(int)dentry->d_name.len, 264 pr_debug("AFFS: create(%lu,\"%.*s\",0%ho)\n",dir->i_ino,(int)dentry->d_name.len,
265 dentry->d_name.name,mode); 265 dentry->d_name.name,mode);
266 266
267 inode = affs_new_inode(dir); 267 inode = affs_new_inode(dir);
@@ -285,12 +285,12 @@ affs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata
285} 285}
286 286
287int 287int
288affs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 288affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
289{ 289{
290 struct inode *inode; 290 struct inode *inode;
291 int error; 291 int error;
292 292
293 pr_debug("AFFS: mkdir(%lu,\"%.*s\",0%o)\n",dir->i_ino, 293 pr_debug("AFFS: mkdir(%lu,\"%.*s\",0%ho)\n",dir->i_ino,
294 (int)dentry->d_name.len,dentry->d_name.name,mode); 294 (int)dentry->d_name.len,dentry->d_name.name,mode);
295 295
296 inode = affs_new_inode(dir); 296 inode = affs_new_inode(dir);
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 1b0b19550015..e22dc4b4a503 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -28,9 +28,9 @@ static int afs_d_delete(const struct dentry *dentry);
28static void afs_d_release(struct dentry *dentry); 28static void afs_d_release(struct dentry *dentry);
29static int afs_lookup_filldir(void *_cookie, const char *name, int nlen, 29static int afs_lookup_filldir(void *_cookie, const char *name, int nlen,
30 loff_t fpos, u64 ino, unsigned dtype); 30 loff_t fpos, u64 ino, unsigned dtype);
31static int afs_create(struct inode *dir, struct dentry *dentry, int mode, 31static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
32 struct nameidata *nd); 32 struct nameidata *nd);
33static int afs_mkdir(struct inode *dir, struct dentry *dentry, int mode); 33static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
34static int afs_rmdir(struct inode *dir, struct dentry *dentry); 34static int afs_rmdir(struct inode *dir, struct dentry *dentry);
35static int afs_unlink(struct inode *dir, struct dentry *dentry); 35static int afs_unlink(struct inode *dir, struct dentry *dentry);
36static int afs_link(struct dentry *from, struct inode *dir, 36static int afs_link(struct dentry *from, struct inode *dir,
@@ -764,7 +764,7 @@ static void afs_d_release(struct dentry *dentry)
764/* 764/*
765 * create a directory on an AFS filesystem 765 * create a directory on an AFS filesystem
766 */ 766 */
767static int afs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 767static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
768{ 768{
769 struct afs_file_status status; 769 struct afs_file_status status;
770 struct afs_callback cb; 770 struct afs_callback cb;
@@ -777,7 +777,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
777 777
778 dvnode = AFS_FS_I(dir); 778 dvnode = AFS_FS_I(dir);
779 779
780 _enter("{%x:%u},{%s},%o", 780 _enter("{%x:%u},{%s},%ho",
781 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode); 781 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode);
782 782
783 ret = -ENAMETOOLONG; 783 ret = -ENAMETOOLONG;
@@ -948,7 +948,7 @@ error:
948/* 948/*
949 * create a regular file on an AFS filesystem 949 * create a regular file on an AFS filesystem
950 */ 950 */
951static int afs_create(struct inode *dir, struct dentry *dentry, int mode, 951static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
952 struct nameidata *nd) 952 struct nameidata *nd)
953{ 953{
954 struct afs_file_status status; 954 struct afs_file_status status;
@@ -962,7 +962,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, int mode,
962 962
963 dvnode = AFS_FS_I(dir); 963 dvnode = AFS_FS_I(dir);
964 964
965 _enter("{%x:%u},{%s},%o,", 965 _enter("{%x:%u},{%s},%ho,",
966 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode); 966 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode);
967 967
968 ret = -ENAMETOOLONG; 968 ret = -ENAMETOOLONG;
diff --git a/fs/attr.c b/fs/attr.c
index 7ee7ba488313..95053ad8abcc 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -166,7 +166,7 @@ EXPORT_SYMBOL(setattr_copy);
166int notify_change(struct dentry * dentry, struct iattr * attr) 166int notify_change(struct dentry * dentry, struct iattr * attr)
167{ 167{
168 struct inode *inode = dentry->d_inode; 168 struct inode *inode = dentry->d_inode;
169 mode_t mode = inode->i_mode; 169 umode_t mode = inode->i_mode;
170 int error; 170 int error;
171 struct timespec now; 171 struct timespec now;
172 unsigned int ia_valid = attr->ia_valid; 172 unsigned int ia_valid = attr->ia_valid;
@@ -177,7 +177,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
177 } 177 }
178 178
179 if ((ia_valid & ATTR_MODE)) { 179 if ((ia_valid & ATTR_MODE)) {
180 mode_t amode = attr->ia_mode; 180 umode_t amode = attr->ia_mode;
181 /* Flag setting protected by i_mutex */ 181 /* Flag setting protected by i_mutex */
182 if (is_sxid(amode)) 182 if (is_sxid(amode))
183 inode->i_flags &= ~S_NOSEC; 183 inode->i_flags &= ~S_NOSEC;
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index 326dc08d3e3f..5869d4e974a9 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -155,7 +155,7 @@ static inline int autofs4_ispending(struct dentry *dentry)
155 return 0; 155 return 0;
156} 156}
157 157
158struct inode *autofs4_get_inode(struct super_block *, mode_t); 158struct inode *autofs4_get_inode(struct super_block *, umode_t);
159void autofs4_free_ino(struct autofs_info *); 159void autofs4_free_ino(struct autofs_info *);
160 160
161/* Expiration */ 161/* Expiration */
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 8179f1ab8175..f799efad52a8 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -326,7 +326,7 @@ fail_unlock:
326 return -EINVAL; 326 return -EINVAL;
327} 327}
328 328
329struct inode *autofs4_get_inode(struct super_block *sb, mode_t mode) 329struct inode *autofs4_get_inode(struct super_block *sb, umode_t mode)
330{ 330{
331 struct inode *inode = new_inode(sb); 331 struct inode *inode = new_inode(sb);
332 332
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index f55ae23b137e..75e5f1c8e028 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -26,7 +26,7 @@
26static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *); 26static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *);
27static int autofs4_dir_unlink(struct inode *,struct dentry *); 27static int autofs4_dir_unlink(struct inode *,struct dentry *);
28static int autofs4_dir_rmdir(struct inode *,struct dentry *); 28static int autofs4_dir_rmdir(struct inode *,struct dentry *);
29static int autofs4_dir_mkdir(struct inode *,struct dentry *,int); 29static int autofs4_dir_mkdir(struct inode *,struct dentry *,umode_t);
30static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long); 30static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long);
31#ifdef CONFIG_COMPAT 31#ifdef CONFIG_COMPAT
32static long autofs4_root_compat_ioctl(struct file *,unsigned int,unsigned long); 32static long autofs4_root_compat_ioctl(struct file *,unsigned int,unsigned long);
@@ -699,7 +699,7 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
699 return 0; 699 return 0;
700} 700}
701 701
702static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode) 702static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
703{ 703{
704 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); 704 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
705 struct autofs_info *ino = autofs4_dentry_ino(dentry); 705 struct autofs_info *ino = autofs4_dentry_ino(dentry);
diff --git a/fs/bad_inode.c b/fs/bad_inode.c
index 9205cf25f1c6..22e9a78872ff 100644
--- a/fs/bad_inode.c
+++ b/fs/bad_inode.c
@@ -173,7 +173,7 @@ static const struct file_operations bad_file_ops =
173}; 173};
174 174
175static int bad_inode_create (struct inode *dir, struct dentry *dentry, 175static int bad_inode_create (struct inode *dir, struct dentry *dentry,
176 int mode, struct nameidata *nd) 176 umode_t mode, struct nameidata *nd)
177{ 177{
178 return -EIO; 178 return -EIO;
179} 179}
@@ -202,7 +202,7 @@ static int bad_inode_symlink (struct inode *dir, struct dentry *dentry,
202} 202}
203 203
204static int bad_inode_mkdir(struct inode *dir, struct dentry *dentry, 204static int bad_inode_mkdir(struct inode *dir, struct dentry *dentry,
205 int mode) 205 umode_t mode)
206{ 206{
207 return -EIO; 207 return -EIO;
208} 208}
@@ -213,7 +213,7 @@ static int bad_inode_rmdir (struct inode *dir, struct dentry *dentry)
213} 213}
214 214
215static int bad_inode_mknod (struct inode *dir, struct dentry *dentry, 215static int bad_inode_mknod (struct inode *dir, struct dentry *dentry,
216 int mode, dev_t rdev) 216 umode_t mode, dev_t rdev)
217{ 217{
218 return -EIO; 218 return -EIO;
219} 219}
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 9cc074019479..d12c7966db27 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -84,7 +84,7 @@ const struct file_operations bfs_dir_operations = {
84 84
85extern void dump_imap(const char *, struct super_block *); 85extern void dump_imap(const char *, struct super_block *);
86 86
87static int bfs_create(struct inode *dir, struct dentry *dentry, int mode, 87static int bfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
88 struct nameidata *nd) 88 struct nameidata *nd)
89{ 89{
90 int err; 90 int err;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index f8ff9738558a..2f426a51e60d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4412,8 +4412,8 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
4412 struct btrfs_root *root, 4412 struct btrfs_root *root,
4413 struct inode *dir, 4413 struct inode *dir,
4414 const char *name, int name_len, 4414 const char *name, int name_len,
4415 u64 ref_objectid, u64 objectid, int mode, 4415 u64 ref_objectid, u64 objectid,
4416 u64 *index) 4416 umode_t mode, u64 *index)
4417{ 4417{
4418 struct inode *inode; 4418 struct inode *inode;
4419 struct btrfs_inode_item *inode_item; 4419 struct btrfs_inode_item *inode_item;
@@ -4596,7 +4596,7 @@ static int btrfs_add_nondir(struct btrfs_trans_handle *trans,
4596} 4596}
4597 4597
4598static int btrfs_mknod(struct inode *dir, struct dentry *dentry, 4598static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
4599 int mode, dev_t rdev) 4599 umode_t mode, dev_t rdev)
4600{ 4600{
4601 struct btrfs_trans_handle *trans; 4601 struct btrfs_trans_handle *trans;
4602 struct btrfs_root *root = BTRFS_I(dir)->root; 4602 struct btrfs_root *root = BTRFS_I(dir)->root;
@@ -4665,7 +4665,7 @@ out_unlock:
4665} 4665}
4666 4666
4667static int btrfs_create(struct inode *dir, struct dentry *dentry, 4667static int btrfs_create(struct inode *dir, struct dentry *dentry,
4668 int mode, struct nameidata *nd) 4668 umode_t mode, struct nameidata *nd)
4669{ 4669{
4670 struct btrfs_trans_handle *trans; 4670 struct btrfs_trans_handle *trans;
4671 struct btrfs_root *root = BTRFS_I(dir)->root; 4671 struct btrfs_root *root = BTRFS_I(dir)->root;
@@ -4792,7 +4792,7 @@ fail:
4792 return err; 4792 return err;
4793} 4793}
4794 4794
4795static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 4795static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
4796{ 4796{
4797 struct inode *inode = NULL; 4797 struct inode *inode = NULL;
4798 struct btrfs_trans_handle *trans; 4798 struct btrfs_trans_handle *trans;
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 8b53193e4f7c..b60fc8bfb3e9 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -928,7 +928,7 @@ static int send_cap_msg(struct ceph_mds_session *session,
928 u64 size, u64 max_size, 928 u64 size, u64 max_size,
929 struct timespec *mtime, struct timespec *atime, 929 struct timespec *mtime, struct timespec *atime,
930 u64 time_warp_seq, 930 u64 time_warp_seq,
931 uid_t uid, gid_t gid, mode_t mode, 931 uid_t uid, gid_t gid, umode_t mode,
932 u64 xattr_version, 932 u64 xattr_version,
933 struct ceph_buffer *xattrs_buf, 933 struct ceph_buffer *xattrs_buf,
934 u64 follows) 934 u64 follows)
@@ -1078,7 +1078,7 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
1078 u64 size, max_size; 1078 u64 size, max_size;
1079 struct timespec mtime, atime; 1079 struct timespec mtime, atime;
1080 int wake = 0; 1080 int wake = 0;
1081 mode_t mode; 1081 umode_t mode;
1082 uid_t uid; 1082 uid_t uid;
1083 gid_t gid; 1083 gid_t gid;
1084 struct ceph_mds_session *session; 1084 struct ceph_mds_session *session;
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 98954003a8d3..74fd74719dc2 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -666,7 +666,7 @@ int ceph_handle_notrace_create(struct inode *dir, struct dentry *dentry)
666} 666}
667 667
668static int ceph_mknod(struct inode *dir, struct dentry *dentry, 668static int ceph_mknod(struct inode *dir, struct dentry *dentry,
669 int mode, dev_t rdev) 669 umode_t mode, dev_t rdev)
670{ 670{
671 struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); 671 struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
672 struct ceph_mds_client *mdsc = fsc->mdsc; 672 struct ceph_mds_client *mdsc = fsc->mdsc;
@@ -676,7 +676,7 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry,
676 if (ceph_snap(dir) != CEPH_NOSNAP) 676 if (ceph_snap(dir) != CEPH_NOSNAP)
677 return -EROFS; 677 return -EROFS;
678 678
679 dout("mknod in dir %p dentry %p mode 0%o rdev %d\n", 679 dout("mknod in dir %p dentry %p mode 0%ho rdev %d\n",
680 dir, dentry, mode, rdev); 680 dir, dentry, mode, rdev);
681 req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_MKNOD, USE_AUTH_MDS); 681 req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_MKNOD, USE_AUTH_MDS);
682 if (IS_ERR(req)) { 682 if (IS_ERR(req)) {
@@ -699,7 +699,7 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry,
699 return err; 699 return err;
700} 700}
701 701
702static int ceph_create(struct inode *dir, struct dentry *dentry, int mode, 702static int ceph_create(struct inode *dir, struct dentry *dentry, umode_t mode,
703 struct nameidata *nd) 703 struct nameidata *nd)
704{ 704{
705 dout("create in dir %p dentry %p name '%.*s'\n", 705 dout("create in dir %p dentry %p name '%.*s'\n",
@@ -753,7 +753,7 @@ static int ceph_symlink(struct inode *dir, struct dentry *dentry,
753 return err; 753 return err;
754} 754}
755 755
756static int ceph_mkdir(struct inode *dir, struct dentry *dentry, int mode) 756static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
757{ 757{
758 struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); 758 struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
759 struct ceph_mds_client *mdsc = fsc->mdsc; 759 struct ceph_mds_client *mdsc = fsc->mdsc;
@@ -767,7 +767,7 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, int mode)
767 dout("mksnap dir %p snap '%.*s' dn %p\n", dir, 767 dout("mksnap dir %p snap '%.*s' dn %p\n", dir,
768 dentry->d_name.len, dentry->d_name.name, dentry); 768 dentry->d_name.len, dentry->d_name.name, dentry);
769 } else if (ceph_snap(dir) == CEPH_NOSNAP) { 769 } else if (ceph_snap(dir) == CEPH_NOSNAP) {
770 dout("mkdir dir %p dn %p mode 0%o\n", dir, dentry, mode); 770 dout("mkdir dir %p dn %p mode 0%ho\n", dir, dentry, mode);
771 op = CEPH_MDS_OP_MKDIR; 771 op = CEPH_MDS_OP_MKDIR;
772 } else { 772 } else {
773 goto out; 773 goto out;
@@ -870,7 +870,7 @@ static int ceph_unlink(struct inode *dir, struct dentry *dentry)
870 } else if (ceph_snap(dir) == CEPH_NOSNAP) { 870 } else if (ceph_snap(dir) == CEPH_NOSNAP) {
871 dout("unlink/rmdir dir %p dn %p inode %p\n", 871 dout("unlink/rmdir dir %p dn %p inode %p\n",
872 dir, dentry, inode); 872 dir, dentry, inode);
873 op = ((dentry->d_inode->i_mode & S_IFMT) == S_IFDIR) ? 873 op = S_ISDIR(dentry->d_inode->i_mode) ?
874 CEPH_MDS_OP_RMDIR : CEPH_MDS_OP_UNLINK; 874 CEPH_MDS_OP_RMDIR : CEPH_MDS_OP_UNLINK;
875 } else 875 } else
876 goto out; 876 goto out;
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index edcbf3774a56..cb3652b37271 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -136,7 +136,7 @@ struct ceph_cap_snap {
136 int issued, dirty; 136 int issued, dirty;
137 struct ceph_snap_context *context; 137 struct ceph_snap_context *context;
138 138
139 mode_t mode; 139 umode_t mode;
140 uid_t uid; 140 uid_t uid;
141 gid_t gid; 141 gid_t gid;
142 142
diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h
index 500d65859279..c865bfdfe819 100644
--- a/fs/cifs/cifs_fs_sb.h
+++ b/fs/cifs/cifs_fs_sb.h
@@ -59,8 +59,8 @@ struct cifs_sb_info {
59 gid_t mnt_gid; 59 gid_t mnt_gid;
60 uid_t mnt_backupuid; 60 uid_t mnt_backupuid;
61 gid_t mnt_backupgid; 61 gid_t mnt_backupgid;
62 mode_t mnt_file_mode; 62 umode_t mnt_file_mode;
63 mode_t mnt_dir_mode; 63 umode_t mnt_dir_mode;
64 unsigned int mnt_cifs_flags; 64 unsigned int mnt_cifs_flags;
65 char *mountdata; /* options received at mount time or via DFS refs */ 65 char *mountdata; /* options received at mount time or via DFS refs */
66 struct backing_dev_info bdi; 66 struct backing_dev_info bdi;
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 8f1fe324162b..5bb961c13c4d 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -393,7 +393,7 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m)
393 cifs_show_address(s, tcon->ses->server); 393 cifs_show_address(s, tcon->ses->server);
394 394
395 if (!tcon->unix_ext) 395 if (!tcon->unix_ext)
396 seq_printf(s, ",file_mode=0%o,dir_mode=0%o", 396 seq_printf(s, ",file_mode=0%ho,dir_mode=0%ho",
397 cifs_sb->mnt_file_mode, 397 cifs_sb->mnt_file_mode,
398 cifs_sb->mnt_dir_mode); 398 cifs_sb->mnt_dir_mode);
399 if (tcon->seal) 399 if (tcon->seal)
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 30ff56005d8f..fe5ecf1b422a 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -44,14 +44,14 @@ extern const struct address_space_operations cifs_addr_ops_smallbuf;
44/* Functions related to inodes */ 44/* Functions related to inodes */
45extern const struct inode_operations cifs_dir_inode_ops; 45extern const struct inode_operations cifs_dir_inode_ops;
46extern struct inode *cifs_root_iget(struct super_block *); 46extern struct inode *cifs_root_iget(struct super_block *);
47extern int cifs_create(struct inode *, struct dentry *, int, 47extern int cifs_create(struct inode *, struct dentry *, umode_t,
48 struct nameidata *); 48 struct nameidata *);
49extern struct dentry *cifs_lookup(struct inode *, struct dentry *, 49extern struct dentry *cifs_lookup(struct inode *, struct dentry *,
50 struct nameidata *); 50 struct nameidata *);
51extern int cifs_unlink(struct inode *dir, struct dentry *dentry); 51extern int cifs_unlink(struct inode *dir, struct dentry *dentry);
52extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *); 52extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *);
53extern int cifs_mknod(struct inode *, struct dentry *, int, dev_t); 53extern int cifs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
54extern int cifs_mkdir(struct inode *, struct dentry *, int); 54extern int cifs_mkdir(struct inode *, struct dentry *, umode_t);
55extern int cifs_rmdir(struct inode *, struct dentry *); 55extern int cifs_rmdir(struct inode *, struct dentry *);
56extern int cifs_rename(struct inode *, struct dentry *, struct inode *, 56extern int cifs_rename(struct inode *, struct dentry *, struct inode *,
57 struct dentry *); 57 struct dentry *);
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 8238aa13e01c..ba53c1c6c6cc 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -169,8 +169,8 @@ struct smb_vol {
169 gid_t linux_gid; 169 gid_t linux_gid;
170 uid_t backupuid; 170 uid_t backupuid;
171 gid_t backupgid; 171 gid_t backupgid;
172 mode_t file_mode; 172 umode_t file_mode;
173 mode_t dir_mode; 173 umode_t dir_mode;
174 unsigned secFlg; 174 unsigned secFlg;
175 bool retry:1; 175 bool retry:1;
176 bool intr:1; 176 bool intr:1;
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 8cd4b52d4217..be1e8f91c0ad 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2819,7 +2819,7 @@ void cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
2819 cifs_sb->mnt_backupgid = pvolume_info->backupgid; 2819 cifs_sb->mnt_backupgid = pvolume_info->backupgid;
2820 cifs_sb->mnt_file_mode = pvolume_info->file_mode; 2820 cifs_sb->mnt_file_mode = pvolume_info->file_mode;
2821 cifs_sb->mnt_dir_mode = pvolume_info->dir_mode; 2821 cifs_sb->mnt_dir_mode = pvolume_info->dir_mode;
2822 cFYI(1, "file mode: 0x%x dir mode: 0x%x", 2822 cFYI(1, "file mode: 0x%hx dir mode: 0x%hx",
2823 cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); 2823 cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode);
2824 2824
2825 cifs_sb->actimeo = pvolume_info->actimeo; 2825 cifs_sb->actimeo = pvolume_info->actimeo;
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index d7eeb9d3ed6f..df8fecb5b993 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -136,7 +136,7 @@ cifs_bp_rename_retry:
136/* Inode operations in similar order to how they appear in Linux file fs.h */ 136/* Inode operations in similar order to how they appear in Linux file fs.h */
137 137
138int 138int
139cifs_create(struct inode *inode, struct dentry *direntry, int mode, 139cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode,
140 struct nameidata *nd) 140 struct nameidata *nd)
141{ 141{
142 int rc = -ENOENT; 142 int rc = -ENOENT;
@@ -355,7 +355,7 @@ cifs_create_out:
355 return rc; 355 return rc;
356} 356}
357 357
358int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, 358int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode,
359 dev_t device_number) 359 dev_t device_number)
360{ 360{
361 int rc = -EPERM; 361 int rc = -EPERM;
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index e851d5b8931e..a5f54b7d9822 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1264,7 +1264,7 @@ unlink_out:
1264 return rc; 1264 return rc;
1265} 1265}
1266 1266
1267int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) 1267int cifs_mkdir(struct inode *inode, struct dentry *direntry, umode_t mode)
1268{ 1268{
1269 int rc = 0, tmprc; 1269 int rc = 0, tmprc;
1270 int xid; 1270 int xid;
@@ -1275,7 +1275,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
1275 struct inode *newinode = NULL; 1275 struct inode *newinode = NULL;
1276 struct cifs_fattr fattr; 1276 struct cifs_fattr fattr;
1277 1277
1278 cFYI(1, "In cifs_mkdir, mode = 0x%x inode = 0x%p", mode, inode); 1278 cFYI(1, "In cifs_mkdir, mode = 0x%hx inode = 0x%p", mode, inode);
1279 1279
1280 cifs_sb = CIFS_SB(inode->i_sb); 1280 cifs_sb = CIFS_SB(inode->i_sb);
1281 tlink = cifs_sb_tlink(cifs_sb); 1281 tlink = cifs_sb_tlink(cifs_sb);
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 28e7e135cfab..83d2fd8ec24b 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -30,14 +30,14 @@
30#include "coda_int.h" 30#include "coda_int.h"
31 31
32/* dir inode-ops */ 32/* dir inode-ops */
33static int coda_create(struct inode *dir, struct dentry *new, int mode, struct nameidata *nd); 33static int coda_create(struct inode *dir, struct dentry *new, umode_t mode, struct nameidata *nd);
34static struct dentry *coda_lookup(struct inode *dir, struct dentry *target, struct nameidata *nd); 34static struct dentry *coda_lookup(struct inode *dir, struct dentry *target, struct nameidata *nd);
35static int coda_link(struct dentry *old_dentry, struct inode *dir_inode, 35static int coda_link(struct dentry *old_dentry, struct inode *dir_inode,
36 struct dentry *entry); 36 struct dentry *entry);
37static int coda_unlink(struct inode *dir_inode, struct dentry *entry); 37static int coda_unlink(struct inode *dir_inode, struct dentry *entry);
38static int coda_symlink(struct inode *dir_inode, struct dentry *entry, 38static int coda_symlink(struct inode *dir_inode, struct dentry *entry,
39 const char *symname); 39 const char *symname);
40static int coda_mkdir(struct inode *dir_inode, struct dentry *entry, int mode); 40static int coda_mkdir(struct inode *dir_inode, struct dentry *entry, umode_t mode);
41static int coda_rmdir(struct inode *dir_inode, struct dentry *entry); 41static int coda_rmdir(struct inode *dir_inode, struct dentry *entry);
42static int coda_rename(struct inode *old_inode, struct dentry *old_dentry, 42static int coda_rename(struct inode *old_inode, struct dentry *old_dentry,
43 struct inode *new_inode, struct dentry *new_dentry); 43 struct inode *new_inode, struct dentry *new_dentry);
@@ -191,7 +191,7 @@ static inline void coda_dir_drop_nlink(struct inode *dir)
191} 191}
192 192
193/* creation routines: create, mknod, mkdir, link, symlink */ 193/* creation routines: create, mknod, mkdir, link, symlink */
194static int coda_create(struct inode *dir, struct dentry *de, int mode, struct nameidata *nd) 194static int coda_create(struct inode *dir, struct dentry *de, umode_t mode, struct nameidata *nd)
195{ 195{
196 int error; 196 int error;
197 const char *name=de->d_name.name; 197 const char *name=de->d_name.name;
@@ -223,7 +223,7 @@ err_out:
223 return error; 223 return error;
224} 224}
225 225
226static int coda_mkdir(struct inode *dir, struct dentry *de, int mode) 226static int coda_mkdir(struct inode *dir, struct dentry *de, umode_t mode)
227{ 227{
228 struct inode *inode; 228 struct inode *inode;
229 struct coda_vattr attrs; 229 struct coda_vattr attrs;
diff --git a/fs/compat.c b/fs/compat.c
index 9db5a6076610..fa9d721ecfee 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1281,7 +1281,7 @@ compat_sys_vmsplice(int fd, const struct compat_iovec __user *iov32,
1281 * O_LARGEFILE flag. 1281 * O_LARGEFILE flag.
1282 */ 1282 */
1283asmlinkage long 1283asmlinkage long
1284compat_sys_open(const char __user *filename, int flags, int mode) 1284compat_sys_open(const char __user *filename, int flags, umode_t mode)
1285{ 1285{
1286 return do_sys_open(AT_FDCWD, filename, flags, mode); 1286 return do_sys_open(AT_FDCWD, filename, flags, mode);
1287} 1287}
@@ -1291,7 +1291,7 @@ compat_sys_open(const char __user *filename, int flags, int mode)
1291 * O_LARGEFILE flag. 1291 * O_LARGEFILE flag.
1292 */ 1292 */
1293asmlinkage long 1293asmlinkage long
1294compat_sys_openat(unsigned int dfd, const char __user *filename, int flags, int mode) 1294compat_sys_openat(unsigned int dfd, const char __user *filename, int flags, umode_t mode)
1295{ 1295{
1296 return do_sys_open(dfd, filename, flags, mode); 1296 return do_sys_open(dfd, filename, flags, mode);
1297} 1297}
diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h
index 82bda8fdfc1c..ede857d20a04 100644
--- a/fs/configfs/configfs_internal.h
+++ b/fs/configfs/configfs_internal.h
@@ -63,8 +63,8 @@ extern struct kmem_cache *configfs_dir_cachep;
63 63
64extern int configfs_is_root(struct config_item *item); 64extern int configfs_is_root(struct config_item *item);
65 65
66extern struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent *); 66extern struct inode * configfs_new_inode(umode_t mode, struct configfs_dirent *);
67extern int configfs_create(struct dentry *, int mode, int (*init)(struct inode *)); 67extern int configfs_create(struct dentry *, umode_t mode, int (*init)(struct inode *));
68extern int configfs_inode_init(void); 68extern int configfs_inode_init(void);
69extern void configfs_inode_exit(void); 69extern void configfs_inode_exit(void);
70 70
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 1c5296911104..5ddd7ebd9dcd 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -1170,7 +1170,7 @@ void configfs_undepend_item(struct configfs_subsystem *subsys,
1170} 1170}
1171EXPORT_SYMBOL(configfs_undepend_item); 1171EXPORT_SYMBOL(configfs_undepend_item);
1172 1172
1173static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 1173static int configfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
1174{ 1174{
1175 int ret = 0; 1175 int ret = 0;
1176 int module_got = 0; 1176 int module_got = 0;
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c
index 9d8715c45f25..3ee36d418863 100644
--- a/fs/configfs/inode.c
+++ b/fs/configfs/inode.c
@@ -116,7 +116,7 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
116 return error; 116 return error;
117} 117}
118 118
119static inline void set_default_inode_attr(struct inode * inode, mode_t mode) 119static inline void set_default_inode_attr(struct inode * inode, umode_t mode)
120{ 120{
121 inode->i_mode = mode; 121 inode->i_mode = mode;
122 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 122 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
@@ -132,7 +132,7 @@ static inline void set_inode_attr(struct inode * inode, struct iattr * iattr)
132 inode->i_ctime = iattr->ia_ctime; 132 inode->i_ctime = iattr->ia_ctime;
133} 133}
134 134
135struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent * sd) 135struct inode *configfs_new_inode(umode_t mode, struct configfs_dirent * sd)
136{ 136{
137 struct inode * inode = new_inode(configfs_sb); 137 struct inode * inode = new_inode(configfs_sb);
138 if (inode) { 138 if (inode) {
@@ -185,7 +185,7 @@ static void configfs_set_inode_lock_class(struct configfs_dirent *sd,
185 185
186#endif /* CONFIG_LOCKDEP */ 186#endif /* CONFIG_LOCKDEP */
187 187
188int configfs_create(struct dentry * dentry, int mode, int (*init)(struct inode *)) 188int configfs_create(struct dentry * dentry, umode_t mode, int (*init)(struct inode *))
189{ 189{
190 int error = 0; 190 int error = 0;
191 struct inode * inode = NULL; 191 struct inode * inode = NULL;
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index c37adb222113..a2ee8f9f5a38 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -377,7 +377,7 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
377 unsigned long nextoffset; 377 unsigned long nextoffset;
378 char *name; 378 char *name;
379 ino_t ino; 379 ino_t ino;
380 mode_t mode; 380 umode_t mode;
381 int namelen, error; 381 int namelen, error;
382 382
383 mutex_lock(&read_mutex); 383 mutex_lock(&read_mutex);
diff --git a/fs/dcache.c b/fs/dcache.c
index 64c8ce4c147f..9791b1e7eee4 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2452,6 +2452,7 @@ static int prepend_path(const struct path *path,
2452{ 2452{
2453 struct dentry *dentry = path->dentry; 2453 struct dentry *dentry = path->dentry;
2454 struct vfsmount *vfsmnt = path->mnt; 2454 struct vfsmount *vfsmnt = path->mnt;
2455 struct mount *mnt = real_mount(vfsmnt);
2455 bool slash = false; 2456 bool slash = false;
2456 int error = 0; 2457 int error = 0;
2457 2458
@@ -2461,10 +2462,11 @@ static int prepend_path(const struct path *path,
2461 2462
2462 if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) { 2463 if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
2463 /* Global root? */ 2464 /* Global root? */
2464 if (!mnt_has_parent(vfsmnt)) 2465 if (!mnt_has_parent(mnt))
2465 goto global_root; 2466 goto global_root;
2466 dentry = vfsmnt->mnt_mountpoint; 2467 dentry = mnt->mnt_mountpoint;
2467 vfsmnt = vfsmnt->mnt_parent; 2468 mnt = mnt->mnt_parent;
2469 vfsmnt = &mnt->mnt;
2468 continue; 2470 continue;
2469 } 2471 }
2470 parent = dentry->d_parent; 2472 parent = dentry->d_parent;
@@ -2501,7 +2503,7 @@ global_root:
2501 if (!slash) 2503 if (!slash)
2502 error = prepend(buffer, buflen, "/", 1); 2504 error = prepend(buffer, buflen, "/", 1);
2503 if (!error) 2505 if (!error)
2504 error = vfsmnt->mnt_ns ? 1 : 2; 2506 error = real_mount(vfsmnt)->mnt_ns ? 1 : 2;
2505 goto out; 2507 goto out;
2506} 2508}
2507 2509
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 90f76575c056..d5016606fb27 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -95,7 +95,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_u8_wo, NULL, debugfs_u8_set, "%llu\n");
95 * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling 95 * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
96 * code. 96 * code.
97 */ 97 */
98struct dentry *debugfs_create_u8(const char *name, mode_t mode, 98struct dentry *debugfs_create_u8(const char *name, umode_t mode,
99 struct dentry *parent, u8 *value) 99 struct dentry *parent, u8 *value)
100{ 100{
101 /* if there are no write bits set, make read only */ 101 /* if there are no write bits set, make read only */
@@ -147,7 +147,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_u16_wo, NULL, debugfs_u16_set, "%llu\n");
147 * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling 147 * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
148 * code. 148 * code.
149 */ 149 */
150struct dentry *debugfs_create_u16(const char *name, mode_t mode, 150struct dentry *debugfs_create_u16(const char *name, umode_t mode,
151 struct dentry *parent, u16 *value) 151 struct dentry *parent, u16 *value)
152{ 152{
153 /* if there are no write bits set, make read only */ 153 /* if there are no write bits set, make read only */
@@ -199,7 +199,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_u32_wo, NULL, debugfs_u32_set, "%llu\n");
199 * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling 199 * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
200 * code. 200 * code.
201 */ 201 */
202struct dentry *debugfs_create_u32(const char *name, mode_t mode, 202struct dentry *debugfs_create_u32(const char *name, umode_t mode,
203 struct dentry *parent, u32 *value) 203 struct dentry *parent, u32 *value)
204{ 204{
205 /* if there are no write bits set, make read only */ 205 /* if there are no write bits set, make read only */
@@ -252,7 +252,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_u64_wo, NULL, debugfs_u64_set, "%llu\n");
252 * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling 252 * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
253 * code. 253 * code.
254 */ 254 */
255struct dentry *debugfs_create_u64(const char *name, mode_t mode, 255struct dentry *debugfs_create_u64(const char *name, umode_t mode,
256 struct dentry *parent, u64 *value) 256 struct dentry *parent, u64 *value)
257{ 257{
258 /* if there are no write bits set, make read only */ 258 /* if there are no write bits set, make read only */
@@ -298,7 +298,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_x64, debugfs_u64_get, debugfs_u64_set, "0x%016llx\n
298 * @value: a pointer to the variable that the file should read to and write 298 * @value: a pointer to the variable that the file should read to and write
299 * from. 299 * from.
300 */ 300 */
301struct dentry *debugfs_create_x8(const char *name, mode_t mode, 301struct dentry *debugfs_create_x8(const char *name, umode_t mode,
302 struct dentry *parent, u8 *value) 302 struct dentry *parent, u8 *value)
303{ 303{
304 /* if there are no write bits set, make read only */ 304 /* if there are no write bits set, make read only */
@@ -322,7 +322,7 @@ EXPORT_SYMBOL_GPL(debugfs_create_x8);
322 * @value: a pointer to the variable that the file should read to and write 322 * @value: a pointer to the variable that the file should read to and write
323 * from. 323 * from.
324 */ 324 */
325struct dentry *debugfs_create_x16(const char *name, mode_t mode, 325struct dentry *debugfs_create_x16(const char *name, umode_t mode,
326 struct dentry *parent, u16 *value) 326 struct dentry *parent, u16 *value)
327{ 327{
328 /* if there are no write bits set, make read only */ 328 /* if there are no write bits set, make read only */
@@ -346,7 +346,7 @@ EXPORT_SYMBOL_GPL(debugfs_create_x16);
346 * @value: a pointer to the variable that the file should read to and write 346 * @value: a pointer to the variable that the file should read to and write
347 * from. 347 * from.
348 */ 348 */
349struct dentry *debugfs_create_x32(const char *name, mode_t mode, 349struct dentry *debugfs_create_x32(const char *name, umode_t mode,
350 struct dentry *parent, u32 *value) 350 struct dentry *parent, u32 *value)
351{ 351{
352 /* if there are no write bits set, make read only */ 352 /* if there are no write bits set, make read only */
@@ -370,7 +370,7 @@ EXPORT_SYMBOL_GPL(debugfs_create_x32);
370 * @value: a pointer to the variable that the file should read to and write 370 * @value: a pointer to the variable that the file should read to and write
371 * from. 371 * from.
372 */ 372 */
373struct dentry *debugfs_create_x64(const char *name, mode_t mode, 373struct dentry *debugfs_create_x64(const char *name, umode_t mode,
374 struct dentry *parent, u64 *value) 374 struct dentry *parent, u64 *value)
375{ 375{
376 return debugfs_create_file(name, mode, parent, value, &fops_x64); 376 return debugfs_create_file(name, mode, parent, value, &fops_x64);
@@ -401,7 +401,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_size_t, debugfs_size_t_get, debugfs_size_t_set,
401 * @value: a pointer to the variable that the file should read to and write 401 * @value: a pointer to the variable that the file should read to and write
402 * from. 402 * from.
403 */ 403 */
404struct dentry *debugfs_create_size_t(const char *name, mode_t mode, 404struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
405 struct dentry *parent, size_t *value) 405 struct dentry *parent, size_t *value)
406{ 406{
407 return debugfs_create_file(name, mode, parent, value, &fops_size_t); 407 return debugfs_create_file(name, mode, parent, value, &fops_size_t);
@@ -473,7 +473,7 @@ static const struct file_operations fops_bool = {
473 * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling 473 * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
474 * code. 474 * code.
475 */ 475 */
476struct dentry *debugfs_create_bool(const char *name, mode_t mode, 476struct dentry *debugfs_create_bool(const char *name, umode_t mode,
477 struct dentry *parent, u32 *value) 477 struct dentry *parent, u32 *value)
478{ 478{
479 return debugfs_create_file(name, mode, parent, value, &fops_bool); 479 return debugfs_create_file(name, mode, parent, value, &fops_bool);
@@ -518,7 +518,7 @@ static const struct file_operations fops_blob = {
518 * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling 518 * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
519 * code. 519 * code.
520 */ 520 */
521struct dentry *debugfs_create_blob(const char *name, mode_t mode, 521struct dentry *debugfs_create_blob(const char *name, umode_t mode,
522 struct dentry *parent, 522 struct dentry *parent,
523 struct debugfs_blob_wrapper *blob) 523 struct debugfs_blob_wrapper *blob)
524{ 524{
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index c9dc08d0c100..956d5ddddf6e 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -30,7 +30,7 @@ static struct vfsmount *debugfs_mount;
30static int debugfs_mount_count; 30static int debugfs_mount_count;
31static bool debugfs_registered; 31static bool debugfs_registered;
32 32
33static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t dev, 33static struct inode *debugfs_get_inode(struct super_block *sb, umode_t mode, dev_t dev,
34 void *data, const struct file_operations *fops) 34 void *data, const struct file_operations *fops)
35 35
36{ 36{
@@ -69,7 +69,7 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
69 69
70/* SMP-safe */ 70/* SMP-safe */
71static int debugfs_mknod(struct inode *dir, struct dentry *dentry, 71static int debugfs_mknod(struct inode *dir, struct dentry *dentry,
72 int mode, dev_t dev, void *data, 72 umode_t mode, dev_t dev, void *data,
73 const struct file_operations *fops) 73 const struct file_operations *fops)
74{ 74{
75 struct inode *inode; 75 struct inode *inode;
@@ -87,7 +87,7 @@ static int debugfs_mknod(struct inode *dir, struct dentry *dentry,
87 return error; 87 return error;
88} 88}
89 89
90static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, int mode, 90static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode,
91 void *data, const struct file_operations *fops) 91 void *data, const struct file_operations *fops)
92{ 92{
93 int res; 93 int res;
@@ -101,14 +101,14 @@ static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, int mode,
101 return res; 101 return res;
102} 102}
103 103
104static int debugfs_link(struct inode *dir, struct dentry *dentry, int mode, 104static int debugfs_link(struct inode *dir, struct dentry *dentry, umode_t mode,
105 void *data, const struct file_operations *fops) 105 void *data, const struct file_operations *fops)
106{ 106{
107 mode = (mode & S_IALLUGO) | S_IFLNK; 107 mode = (mode & S_IALLUGO) | S_IFLNK;
108 return debugfs_mknod(dir, dentry, mode, 0, data, fops); 108 return debugfs_mknod(dir, dentry, mode, 0, data, fops);
109} 109}
110 110
111static int debugfs_create(struct inode *dir, struct dentry *dentry, int mode, 111static int debugfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
112 void *data, const struct file_operations *fops) 112 void *data, const struct file_operations *fops)
113{ 113{
114 int res; 114 int res;
@@ -146,7 +146,7 @@ static struct file_system_type debug_fs_type = {
146 .kill_sb = kill_litter_super, 146 .kill_sb = kill_litter_super,
147}; 147};
148 148
149static int debugfs_create_by_name(const char *name, mode_t mode, 149static int debugfs_create_by_name(const char *name, umode_t mode,
150 struct dentry *parent, 150 struct dentry *parent,
151 struct dentry **dentry, 151 struct dentry **dentry,
152 void *data, 152 void *data,
@@ -214,7 +214,7 @@ static int debugfs_create_by_name(const char *name, mode_t mode,
214 * If debugfs is not enabled in the kernel, the value -%ENODEV will be 214 * If debugfs is not enabled in the kernel, the value -%ENODEV will be
215 * returned. 215 * returned.
216 */ 216 */
217struct dentry *debugfs_create_file(const char *name, mode_t mode, 217struct dentry *debugfs_create_file(const char *name, umode_t mode,
218 struct dentry *parent, void *data, 218 struct dentry *parent, void *data,
219 const struct file_operations *fops) 219 const struct file_operations *fops)
220{ 220{
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 32f90a3ae63e..19a8ca4ab1dd 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -144,24 +144,6 @@ static int ecryptfs_interpose(struct dentry *lower_dentry,
144} 144}
145 145
146/** 146/**
147 * ecryptfs_create_underlying_file
148 * @lower_dir_inode: inode of the parent in the lower fs of the new file
149 * @dentry: New file's dentry
150 * @mode: The mode of the new file
151 *
152 * Creates the file in the lower file system.
153 *
154 * Returns zero on success; non-zero on error condition
155 */
156static int
157ecryptfs_create_underlying_file(struct inode *lower_dir_inode,
158 struct dentry *dentry, int mode)
159{
160 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
161 return vfs_create(lower_dir_inode, lower_dentry, mode, NULL);
162}
163
164/**
165 * ecryptfs_do_create 147 * ecryptfs_do_create
166 * @directory_inode: inode of the new file's dentry's parent in ecryptfs 148 * @directory_inode: inode of the new file's dentry's parent in ecryptfs
167 * @ecryptfs_dentry: New file's dentry in ecryptfs 149 * @ecryptfs_dentry: New file's dentry in ecryptfs
@@ -176,7 +158,7 @@ ecryptfs_create_underlying_file(struct inode *lower_dir_inode,
176 */ 158 */
177static struct inode * 159static struct inode *
178ecryptfs_do_create(struct inode *directory_inode, 160ecryptfs_do_create(struct inode *directory_inode,
179 struct dentry *ecryptfs_dentry, int mode) 161 struct dentry *ecryptfs_dentry, umode_t mode)
180{ 162{
181 int rc; 163 int rc;
182 struct dentry *lower_dentry; 164 struct dentry *lower_dentry;
@@ -191,8 +173,7 @@ ecryptfs_do_create(struct inode *directory_inode,
191 inode = ERR_CAST(lower_dir_dentry); 173 inode = ERR_CAST(lower_dir_dentry);
192 goto out; 174 goto out;
193 } 175 }
194 rc = ecryptfs_create_underlying_file(lower_dir_dentry->d_inode, 176 rc = vfs_create(lower_dir_dentry->d_inode, lower_dentry, mode, NULL);
195 ecryptfs_dentry, mode);
196 if (rc) { 177 if (rc) {
197 printk(KERN_ERR "%s: Failure to create dentry in lower fs; " 178 printk(KERN_ERR "%s: Failure to create dentry in lower fs; "
198 "rc = [%d]\n", __func__, rc); 179 "rc = [%d]\n", __func__, rc);
@@ -267,7 +248,7 @@ out:
267 */ 248 */
268static int 249static int
269ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry, 250ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry,
270 int mode, struct nameidata *nd) 251 umode_t mode, struct nameidata *nd)
271{ 252{
272 struct inode *ecryptfs_inode; 253 struct inode *ecryptfs_inode;
273 int rc; 254 int rc;
@@ -559,7 +540,7 @@ out_lock:
559 return rc; 540 return rc;
560} 541}
561 542
562static int ecryptfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 543static int ecryptfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
563{ 544{
564 int rc; 545 int rc;
565 struct dentry *lower_dentry; 546 struct dentry *lower_dentry;
@@ -607,7 +588,7 @@ static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry)
607} 588}
608 589
609static int 590static int
610ecryptfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) 591ecryptfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
611{ 592{
612 int rc; 593 int rc;
613 struct dentry *lower_dentry; 594 struct dentry *lower_dentry;
diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c
index d0941c6a1f72..80405836ba6e 100644
--- a/fs/exofs/dir.c
+++ b/fs/exofs/dir.c
@@ -234,7 +234,7 @@ static unsigned char exofs_type_by_mode[S_IFMT >> S_SHIFT] = {
234static inline 234static inline
235void exofs_set_de_type(struct exofs_dir_entry *de, struct inode *inode) 235void exofs_set_de_type(struct exofs_dir_entry *de, struct inode *inode)
236{ 236{
237 mode_t mode = inode->i_mode; 237 umode_t mode = inode->i_mode;
238 de->file_type = exofs_type_by_mode[(mode & S_IFMT) >> S_SHIFT]; 238 de->file_type = exofs_type_by_mode[(mode & S_IFMT) >> S_SHIFT];
239} 239}
240 240
diff --git a/fs/exofs/exofs.h b/fs/exofs/exofs.h
index 51f4b4c40f09..ca9d49665ef6 100644
--- a/fs/exofs/exofs.h
+++ b/fs/exofs/exofs.h
@@ -154,7 +154,7 @@ int exofs_write_begin(struct file *file, struct address_space *mapping,
154 loff_t pos, unsigned len, unsigned flags, 154 loff_t pos, unsigned len, unsigned flags,
155 struct page **pagep, void **fsdata); 155 struct page **pagep, void **fsdata);
156extern struct inode *exofs_iget(struct super_block *, unsigned long); 156extern struct inode *exofs_iget(struct super_block *, unsigned long);
157struct inode *exofs_new_inode(struct inode *, int); 157struct inode *exofs_new_inode(struct inode *, umode_t);
158extern int exofs_write_inode(struct inode *, struct writeback_control *wbc); 158extern int exofs_write_inode(struct inode *, struct writeback_control *wbc);
159extern void exofs_evict_inode(struct inode *); 159extern void exofs_evict_inode(struct inode *);
160 160
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index f6dbf7768ce6..ea5e1f97806a 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -1276,7 +1276,7 @@ static void create_done(struct ore_io_state *ios, void *p)
1276/* 1276/*
1277 * Set up a new inode and create an object for it on the OSD 1277 * Set up a new inode and create an object for it on the OSD
1278 */ 1278 */
1279struct inode *exofs_new_inode(struct inode *dir, int mode) 1279struct inode *exofs_new_inode(struct inode *dir, umode_t mode)
1280{ 1280{
1281 struct super_block *sb = dir->i_sb; 1281 struct super_block *sb = dir->i_sb;
1282 struct exofs_sb_info *sbi = sb->s_fs_info; 1282 struct exofs_sb_info *sbi = sb->s_fs_info;
diff --git a/fs/exofs/namei.c b/fs/exofs/namei.c
index b54c43775f17..9dbf0c301030 100644
--- a/fs/exofs/namei.c
+++ b/fs/exofs/namei.c
@@ -59,7 +59,7 @@ static struct dentry *exofs_lookup(struct inode *dir, struct dentry *dentry,
59 return d_splice_alias(inode, dentry); 59 return d_splice_alias(inode, dentry);
60} 60}
61 61
62static int exofs_create(struct inode *dir, struct dentry *dentry, int mode, 62static int exofs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
63 struct nameidata *nd) 63 struct nameidata *nd)
64{ 64{
65 struct inode *inode = exofs_new_inode(dir, mode); 65 struct inode *inode = exofs_new_inode(dir, mode);
@@ -74,7 +74,7 @@ static int exofs_create(struct inode *dir, struct dentry *dentry, int mode,
74 return err; 74 return err;
75} 75}
76 76
77static int exofs_mknod(struct inode *dir, struct dentry *dentry, int mode, 77static int exofs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
78 dev_t rdev) 78 dev_t rdev)
79{ 79{
80 struct inode *inode; 80 struct inode *inode;
@@ -153,7 +153,7 @@ static int exofs_link(struct dentry *old_dentry, struct inode *dir,
153 return exofs_add_nondir(dentry, inode); 153 return exofs_add_nondir(dentry, inode);
154} 154}
155 155
156static int exofs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 156static int exofs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
157{ 157{
158 struct inode *inode; 158 struct inode *inode;
159 int err = -EMLINK; 159 int err = -EMLINK;
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 47cda410b548..d37df352d324 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -279,7 +279,7 @@ static unsigned char ext2_type_by_mode[S_IFMT >> S_SHIFT] = {
279 279
280static inline void ext2_set_de_type(ext2_dirent *de, struct inode *inode) 280static inline void ext2_set_de_type(ext2_dirent *de, struct inode *inode)
281{ 281{
282 mode_t mode = inode->i_mode; 282 umode_t mode = inode->i_mode;
283 if (EXT2_HAS_INCOMPAT_FEATURE(inode->i_sb, EXT2_FEATURE_INCOMPAT_FILETYPE)) 283 if (EXT2_HAS_INCOMPAT_FEATURE(inode->i_sb, EXT2_FEATURE_INCOMPAT_FILETYPE))
284 de->file_type = ext2_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; 284 de->file_type = ext2_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
285 else 285 else
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index 9a4e5e206d08..75ad433c6691 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -110,7 +110,7 @@ extern struct ext2_dir_entry_2 * ext2_dotdot (struct inode *, struct page **);
110extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, struct inode *, int); 110extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, struct inode *, int);
111 111
112/* ialloc.c */ 112/* ialloc.c */
113extern struct inode * ext2_new_inode (struct inode *, int, const struct qstr *); 113extern struct inode * ext2_new_inode (struct inode *, umode_t, const struct qstr *);
114extern void ext2_free_inode (struct inode *); 114extern void ext2_free_inode (struct inode *);
115extern unsigned long ext2_count_free_inodes (struct super_block *); 115extern unsigned long ext2_count_free_inodes (struct super_block *);
116extern void ext2_check_inodes_bitmap (struct super_block *); 116extern void ext2_check_inodes_bitmap (struct super_block *);
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index c4e81dfb74ba..cd7f5f424a75 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -429,7 +429,7 @@ found:
429 return group; 429 return group;
430} 430}
431 431
432struct inode *ext2_new_inode(struct inode *dir, int mode, 432struct inode *ext2_new_inode(struct inode *dir, umode_t mode,
433 const struct qstr *qstr) 433 const struct qstr *qstr)
434{ 434{
435 struct super_block *sb; 435 struct super_block *sb;
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index 761fde807fc9..080419814bae 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -94,7 +94,7 @@ struct dentry *ext2_get_parent(struct dentry *child)
94 * If the create succeeds, we fill in the inode information 94 * If the create succeeds, we fill in the inode information
95 * with d_instantiate(). 95 * with d_instantiate().
96 */ 96 */
97static int ext2_create (struct inode * dir, struct dentry * dentry, int mode, struct nameidata *nd) 97static int ext2_create (struct inode * dir, struct dentry * dentry, umode_t mode, struct nameidata *nd)
98{ 98{
99 struct inode *inode; 99 struct inode *inode;
100 100
@@ -119,7 +119,7 @@ static int ext2_create (struct inode * dir, struct dentry * dentry, int mode, st
119 return ext2_add_nondir(dentry, inode); 119 return ext2_add_nondir(dentry, inode);
120} 120}
121 121
122static int ext2_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t rdev) 122static int ext2_mknod (struct inode * dir, struct dentry *dentry, umode_t mode, dev_t rdev)
123{ 123{
124 struct inode * inode; 124 struct inode * inode;
125 int err; 125 int err;
@@ -214,7 +214,7 @@ static int ext2_link (struct dentry * old_dentry, struct inode * dir,
214 return err; 214 return err;
215} 215}
216 216
217static int ext2_mkdir(struct inode * dir, struct dentry * dentry, int mode) 217static int ext2_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
218{ 218{
219 struct inode * inode; 219 struct inode * inode;
220 int err = -EMLINK; 220 int err = -EMLINK;
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index 5c866e06e7ab..92cc86dfa23d 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -371,7 +371,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
371 * group to find a free inode. 371 * group to find a free inode.
372 */ 372 */
373struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, 373struct inode *ext3_new_inode(handle_t *handle, struct inode * dir,
374 const struct qstr *qstr, int mode) 374 const struct qstr *qstr, umode_t mode)
375{ 375{
376 struct super_block *sb; 376 struct super_block *sb;
377 struct buffer_head *bitmap_bh = NULL; 377 struct buffer_head *bitmap_bh = NULL;
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 642dc6d66dfd..4f35b2f315d4 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1698,7 +1698,7 @@ static int ext3_add_nondir(handle_t *handle,
1698 * If the create succeeds, we fill in the inode information 1698 * If the create succeeds, we fill in the inode information
1699 * with d_instantiate(). 1699 * with d_instantiate().
1700 */ 1700 */
1701static int ext3_create (struct inode * dir, struct dentry * dentry, int mode, 1701static int ext3_create (struct inode * dir, struct dentry * dentry, umode_t mode,
1702 struct nameidata *nd) 1702 struct nameidata *nd)
1703{ 1703{
1704 handle_t *handle; 1704 handle_t *handle;
@@ -1732,7 +1732,7 @@ retry:
1732} 1732}
1733 1733
1734static int ext3_mknod (struct inode * dir, struct dentry *dentry, 1734static int ext3_mknod (struct inode * dir, struct dentry *dentry,
1735 int mode, dev_t rdev) 1735 umode_t mode, dev_t rdev)
1736{ 1736{
1737 handle_t *handle; 1737 handle_t *handle;
1738 struct inode *inode; 1738 struct inode *inode;
@@ -1768,7 +1768,7 @@ retry:
1768 return err; 1768 return err;
1769} 1769}
1770 1770
1771static int ext3_mkdir(struct inode * dir, struct dentry * dentry, int mode) 1771static int ext3_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
1772{ 1772{
1773 handle_t *handle; 1773 handle_t *handle;
1774 struct inode * inode; 1774 struct inode * inode;
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 5b0e26a1272d..1554b15f91bc 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1819,7 +1819,7 @@ extern int ext4fs_dirhash(const char *name, int len, struct
1819 dx_hash_info *hinfo); 1819 dx_hash_info *hinfo);
1820 1820
1821/* ialloc.c */ 1821/* ialloc.c */
1822extern struct inode *ext4_new_inode(handle_t *, struct inode *, int, 1822extern struct inode *ext4_new_inode(handle_t *, struct inode *, umode_t,
1823 const struct qstr *qstr, __u32 goal, 1823 const struct qstr *qstr, __u32 goal,
1824 uid_t *owner); 1824 uid_t *owner);
1825extern void ext4_free_inode(handle_t *, struct inode *); 1825extern void ext4_free_inode(handle_t *, struct inode *);
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 00beb4f9cc4f..4637af036d9c 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -351,7 +351,7 @@ static void get_orlov_stats(struct super_block *sb, ext4_group_t g,
351 */ 351 */
352 352
353static int find_group_orlov(struct super_block *sb, struct inode *parent, 353static int find_group_orlov(struct super_block *sb, struct inode *parent,
354 ext4_group_t *group, int mode, 354 ext4_group_t *group, umode_t mode,
355 const struct qstr *qstr) 355 const struct qstr *qstr)
356{ 356{
357 ext4_group_t parent_group = EXT4_I(parent)->i_block_group; 357 ext4_group_t parent_group = EXT4_I(parent)->i_block_group;
@@ -497,7 +497,7 @@ fallback_retry:
497} 497}
498 498
499static int find_group_other(struct super_block *sb, struct inode *parent, 499static int find_group_other(struct super_block *sb, struct inode *parent,
500 ext4_group_t *group, int mode) 500 ext4_group_t *group, umode_t mode)
501{ 501{
502 ext4_group_t parent_group = EXT4_I(parent)->i_block_group; 502 ext4_group_t parent_group = EXT4_I(parent)->i_block_group;
503 ext4_group_t i, last, ngroups = ext4_get_groups_count(sb); 503 ext4_group_t i, last, ngroups = ext4_get_groups_count(sb);
@@ -602,7 +602,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent,
602 */ 602 */
603static int ext4_claim_inode(struct super_block *sb, 603static int ext4_claim_inode(struct super_block *sb,
604 struct buffer_head *inode_bitmap_bh, 604 struct buffer_head *inode_bitmap_bh,
605 unsigned long ino, ext4_group_t group, int mode) 605 unsigned long ino, ext4_group_t group, umode_t mode)
606{ 606{
607 int free = 0, retval = 0, count; 607 int free = 0, retval = 0, count;
608 struct ext4_sb_info *sbi = EXT4_SB(sb); 608 struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -690,7 +690,7 @@ err_ret:
690 * For other inodes, search forward from the parent directory's block 690 * For other inodes, search forward from the parent directory's block
691 * group to find a free inode. 691 * group to find a free inode.
692 */ 692 */
693struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode, 693struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, umode_t mode,
694 const struct qstr *qstr, __u32 goal, uid_t *owner) 694 const struct qstr *qstr, __u32 goal, uid_t *owner)
695{ 695{
696 struct super_block *sb; 696 struct super_block *sb;
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index aa4c782c9dd7..86edc45b52a4 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1736,7 +1736,7 @@ static int ext4_add_nondir(handle_t *handle,
1736 * If the create succeeds, we fill in the inode information 1736 * If the create succeeds, we fill in the inode information
1737 * with d_instantiate(). 1737 * with d_instantiate().
1738 */ 1738 */
1739static int ext4_create(struct inode *dir, struct dentry *dentry, int mode, 1739static int ext4_create(struct inode *dir, struct dentry *dentry, umode_t mode,
1740 struct nameidata *nd) 1740 struct nameidata *nd)
1741{ 1741{
1742 handle_t *handle; 1742 handle_t *handle;
@@ -1770,7 +1770,7 @@ retry:
1770} 1770}
1771 1771
1772static int ext4_mknod(struct inode *dir, struct dentry *dentry, 1772static int ext4_mknod(struct inode *dir, struct dentry *dentry,
1773 int mode, dev_t rdev) 1773 umode_t mode, dev_t rdev)
1774{ 1774{
1775 handle_t *handle; 1775 handle_t *handle;
1776 struct inode *inode; 1776 struct inode *inode;
@@ -1806,7 +1806,7 @@ retry:
1806 return err; 1806 return err;
1807} 1807}
1808 1808
1809static int ext4_mkdir(struct inode *dir, struct dentry *dentry, int mode) 1809static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
1810{ 1810{
1811 handle_t *handle; 1811 handle_t *handle;
1812 struct inode *inode; 1812 struct inode *inode;
diff --git a/fs/fat/fat.h b/fs/fat/fat.h
index 1510a4d51990..66994f316e18 100644
--- a/fs/fat/fat.h
+++ b/fs/fat/fat.h
@@ -141,7 +141,7 @@ static inline struct msdos_inode_info *MSDOS_I(struct inode *inode)
141static inline int fat_mode_can_hold_ro(struct inode *inode) 141static inline int fat_mode_can_hold_ro(struct inode *inode)
142{ 142{
143 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); 143 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
144 mode_t mask; 144 umode_t mask;
145 145
146 if (S_ISDIR(inode->i_mode)) { 146 if (S_ISDIR(inode->i_mode)) {
147 if (!sbi->options.rodir) 147 if (!sbi->options.rodir)
@@ -156,8 +156,8 @@ static inline int fat_mode_can_hold_ro(struct inode *inode)
156} 156}
157 157
158/* Convert attribute bits and a mask to the UNIX mode. */ 158/* Convert attribute bits and a mask to the UNIX mode. */
159static inline mode_t fat_make_mode(struct msdos_sb_info *sbi, 159static inline umode_t fat_make_mode(struct msdos_sb_info *sbi,
160 u8 attrs, mode_t mode) 160 u8 attrs, umode_t mode)
161{ 161{
162 if (attrs & ATTR_RO && !((attrs & ATTR_DIR) && !sbi->options.rodir)) 162 if (attrs & ATTR_RO && !((attrs & ATTR_DIR) && !sbi->options.rodir))
163 mode &= ~S_IWUGO; 163 mode &= ~S_IWUGO;
diff --git a/fs/fat/file.c b/fs/fat/file.c
index d81d01a99b2c..a71fe3715ee8 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -314,7 +314,7 @@ EXPORT_SYMBOL_GPL(fat_getattr);
314static int fat_sanitize_mode(const struct msdos_sb_info *sbi, 314static int fat_sanitize_mode(const struct msdos_sb_info *sbi,
315 struct inode *inode, umode_t *mode_ptr) 315 struct inode *inode, umode_t *mode_ptr)
316{ 316{
317 mode_t mask, perm; 317 umode_t mask, perm;
318 318
319 /* 319 /*
320 * Note, the basic check is already done by a caller of 320 * Note, the basic check is already done by a caller of
@@ -351,7 +351,7 @@ static int fat_sanitize_mode(const struct msdos_sb_info *sbi,
351 351
352static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode) 352static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode)
353{ 353{
354 mode_t allow_utime = sbi->options.allow_utime; 354 umode_t allow_utime = sbi->options.allow_utime;
355 355
356 if (current_fsuid() != inode->i_uid) { 356 if (current_fsuid() != inode->i_uid) {
357 if (in_group_p(inode->i_gid)) 357 if (in_group_p(inode->i_gid))
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index 216b419f30e2..c5938c9084b9 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -264,7 +264,7 @@ static int msdos_add_entry(struct inode *dir, const unsigned char *name,
264} 264}
265 265
266/***** Create a file */ 266/***** Create a file */
267static int msdos_create(struct inode *dir, struct dentry *dentry, int mode, 267static int msdos_create(struct inode *dir, struct dentry *dentry, umode_t mode,
268 struct nameidata *nd) 268 struct nameidata *nd)
269{ 269{
270 struct super_block *sb = dir->i_sb; 270 struct super_block *sb = dir->i_sb;
@@ -346,7 +346,7 @@ out:
346} 346}
347 347
348/***** Make a directory */ 348/***** Make a directory */
349static int msdos_mkdir(struct inode *dir, struct dentry *dentry, int mode) 349static int msdos_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
350{ 350{
351 struct super_block *sb = dir->i_sb; 351 struct super_block *sb = dir->i_sb;
352 struct fat_slot_info sinfo; 352 struct fat_slot_info sinfo;
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index a87a65663c25..3a444b4e2368 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -781,7 +781,7 @@ error:
781 return ERR_PTR(err); 781 return ERR_PTR(err);
782} 782}
783 783
784static int vfat_create(struct inode *dir, struct dentry *dentry, int mode, 784static int vfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
785 struct nameidata *nd) 785 struct nameidata *nd)
786{ 786{
787 struct super_block *sb = dir->i_sb; 787 struct super_block *sb = dir->i_sb;
@@ -870,7 +870,7 @@ out:
870 return err; 870 return err;
871} 871}
872 872
873static int vfat_mkdir(struct inode *dir, struct dentry *dentry, int mode) 873static int vfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
874{ 874{
875 struct super_block *sb = dir->i_sb; 875 struct super_block *sb = dir->i_sb;
876 struct inode *inode; 876 struct inode *inode;
diff --git a/fs/fhandle.c b/fs/fhandle.c
index 6b088641f5bf..5eff7116951e 100644
--- a/fs/fhandle.c
+++ b/fs/fhandle.c
@@ -10,6 +10,7 @@
10#include <linux/personality.h> 10#include <linux/personality.h>
11#include <asm/uaccess.h> 11#include <asm/uaccess.h>
12#include "internal.h" 12#include "internal.h"
13#include "mount.h"
13 14
14static long do_sys_name_to_handle(struct path *path, 15static long do_sys_name_to_handle(struct path *path,
15 struct file_handle __user *ufh, 16 struct file_handle __user *ufh,
@@ -66,7 +67,8 @@ static long do_sys_name_to_handle(struct path *path,
66 } else 67 } else
67 retval = 0; 68 retval = 0;
68 /* copy the mount id */ 69 /* copy the mount id */
69 if (copy_to_user(mnt_id, &path->mnt->mnt_id, sizeof(*mnt_id)) || 70 if (copy_to_user(mnt_id, &real_mount(path->mnt)->mnt_id,
71 sizeof(*mnt_id)) ||
70 copy_to_user(ufh, handle, 72 copy_to_user(ufh, handle,
71 sizeof(struct file_handle) + handle_bytes)) 73 sizeof(struct file_handle) + handle_bytes))
72 retval = -EFAULT; 74 retval = -EFAULT;
diff --git a/fs/freevxfs/vxfs_inode.c b/fs/freevxfs/vxfs_inode.c
index 41ef6e715d2f..cf9ef918a2a9 100644
--- a/fs/freevxfs/vxfs_inode.c
+++ b/fs/freevxfs/vxfs_inode.c
@@ -187,10 +187,10 @@ vxfs_stiget(struct super_block *sbp, ino_t ino)
187 * vxfs_transmod returns a Linux mode_t for a given 187 * vxfs_transmod returns a Linux mode_t for a given
188 * VxFS inode structure. 188 * VxFS inode structure.
189 */ 189 */
190static __inline__ mode_t 190static __inline__ umode_t
191vxfs_transmod(struct vxfs_inode_info *vip) 191vxfs_transmod(struct vxfs_inode_info *vip)
192{ 192{
193 mode_t ret = vip->vii_mode & ~VXFS_TYPE_MASK; 193 umode_t ret = vip->vii_mode & ~VXFS_TYPE_MASK;
194 194
195 if (VXFS_ISFIFO(vip)) 195 if (VXFS_ISFIFO(vip))
196 ret |= S_IFIFO; 196 ret |= S_IFIFO;
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 9f63e493a9b6..5ddd6ea8f839 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -369,8 +369,8 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
369 * If the filesystem doesn't support this, then fall back to separate 369 * If the filesystem doesn't support this, then fall back to separate
370 * 'mknod' + 'open' requests. 370 * 'mknod' + 'open' requests.
371 */ 371 */
372static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode, 372static int fuse_create_open(struct inode *dir, struct dentry *entry,
373 struct nameidata *nd) 373 umode_t mode, struct nameidata *nd)
374{ 374{
375 int err; 375 int err;
376 struct inode *inode; 376 struct inode *inode;
@@ -480,7 +480,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
480 */ 480 */
481static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, 481static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
482 struct inode *dir, struct dentry *entry, 482 struct inode *dir, struct dentry *entry,
483 int mode) 483 umode_t mode)
484{ 484{
485 struct fuse_entry_out outarg; 485 struct fuse_entry_out outarg;
486 struct inode *inode; 486 struct inode *inode;
@@ -547,7 +547,7 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
547 return err; 547 return err;
548} 548}
549 549
550static int fuse_mknod(struct inode *dir, struct dentry *entry, int mode, 550static int fuse_mknod(struct inode *dir, struct dentry *entry, umode_t mode,
551 dev_t rdev) 551 dev_t rdev)
552{ 552{
553 struct fuse_mknod_in inarg; 553 struct fuse_mknod_in inarg;
@@ -573,7 +573,7 @@ static int fuse_mknod(struct inode *dir, struct dentry *entry, int mode,
573 return create_new_entry(fc, req, dir, entry, mode); 573 return create_new_entry(fc, req, dir, entry, mode);
574} 574}
575 575
576static int fuse_create(struct inode *dir, struct dentry *entry, int mode, 576static int fuse_create(struct inode *dir, struct dentry *entry, umode_t mode,
577 struct nameidata *nd) 577 struct nameidata *nd)
578{ 578{
579 if (nd) { 579 if (nd) {
@@ -585,7 +585,7 @@ static int fuse_create(struct inode *dir, struct dentry *entry, int mode,
585 return fuse_mknod(dir, entry, mode, 0); 585 return fuse_mknod(dir, entry, mode, 0);
586} 586}
587 587
588static int fuse_mkdir(struct inode *dir, struct dentry *entry, int mode) 588static int fuse_mkdir(struct inode *dir, struct dentry *entry, umode_t mode)
589{ 589{
590 struct fuse_mkdir_in inarg; 590 struct fuse_mkdir_in inarg;
591 struct fuse_conn *fc = get_fuse_conn(dir); 591 struct fuse_conn *fc = get_fuse_conn(dir);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index cf6db0a93219..1964da0257d9 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -80,7 +80,7 @@ struct fuse_inode {
80 80
81 /** The sticky bit in inode->i_mode may have been removed, so 81 /** The sticky bit in inode->i_mode may have been removed, so
82 preserve the original mode */ 82 preserve the original mode */
83 mode_t orig_i_mode; 83 umode_t orig_i_mode;
84 84
85 /** Version of last attribute change */ 85 /** Version of last attribute change */
86 u64 attr_version; 86 u64 attr_version;
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index cfd4959b218c..4b0e59e0a249 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -333,7 +333,7 @@ out:
333 */ 333 */
334 334
335static int create_ok(struct gfs2_inode *dip, const struct qstr *name, 335static int create_ok(struct gfs2_inode *dip, const struct qstr *name,
336 unsigned int mode) 336 umode_t mode)
337{ 337{
338 int error; 338 int error;
339 339
@@ -364,7 +364,7 @@ static int create_ok(struct gfs2_inode *dip, const struct qstr *name,
364 return 0; 364 return 0;
365} 365}
366 366
367static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode, 367static void munge_mode_uid_gid(struct gfs2_inode *dip, umode_t *mode,
368 unsigned int *uid, unsigned int *gid) 368 unsigned int *uid, unsigned int *gid)
369{ 369{
370 if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir && 370 if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir &&
@@ -447,7 +447,7 @@ static void gfs2_init_dir(struct buffer_head *dibh,
447 */ 447 */
448 448
449static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, 449static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
450 const struct gfs2_inum_host *inum, unsigned int mode, 450 const struct gfs2_inum_host *inum, umode_t mode,
451 unsigned int uid, unsigned int gid, 451 unsigned int uid, unsigned int gid,
452 const u64 *generation, dev_t dev, const char *symname, 452 const u64 *generation, dev_t dev, const char *symname,
453 unsigned size, struct buffer_head **bhp) 453 unsigned size, struct buffer_head **bhp)
@@ -516,7 +516,7 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
516} 516}
517 517
518static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, 518static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
519 unsigned int mode, const struct gfs2_inum_host *inum, 519 umode_t mode, const struct gfs2_inum_host *inum,
520 const u64 *generation, dev_t dev, const char *symname, 520 const u64 *generation, dev_t dev, const char *symname,
521 unsigned int size, struct buffer_head **bhp) 521 unsigned int size, struct buffer_head **bhp)
522{ 522{
@@ -659,7 +659,7 @@ static int gfs2_security_init(struct gfs2_inode *dip, struct gfs2_inode *ip,
659 */ 659 */
660 660
661static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, 661static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
662 unsigned int mode, dev_t dev, const char *symname, 662 umode_t mode, dev_t dev, const char *symname,
663 unsigned int size, int excl) 663 unsigned int size, int excl)
664{ 664{
665 const struct qstr *name = &dentry->d_name; 665 const struct qstr *name = &dentry->d_name;
@@ -760,7 +760,7 @@ fail:
760 */ 760 */
761 761
762static int gfs2_create(struct inode *dir, struct dentry *dentry, 762static int gfs2_create(struct inode *dir, struct dentry *dentry,
763 int mode, struct nameidata *nd) 763 umode_t mode, struct nameidata *nd)
764{ 764{
765 int excl = 0; 765 int excl = 0;
766 if (nd && (nd->flags & LOOKUP_EXCL)) 766 if (nd && (nd->flags & LOOKUP_EXCL))
@@ -1129,7 +1129,7 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry,
1129 * Returns: errno 1129 * Returns: errno
1130 */ 1130 */
1131 1131
1132static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode) 1132static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
1133{ 1133{
1134 return gfs2_create_inode(dir, dentry, S_IFDIR | mode, 0, NULL, 0, 0); 1134 return gfs2_create_inode(dir, dentry, S_IFDIR | mode, 0, NULL, 0, 0);
1135} 1135}
@@ -1143,7 +1143,7 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
1143 * 1143 *
1144 */ 1144 */
1145 1145
1146static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode, 1146static int gfs2_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
1147 dev_t dev) 1147 dev_t dev)
1148{ 1148{
1149 return gfs2_create_inode(dir, dentry, mode, dev, NULL, 0, 0); 1149 return gfs2_create_inode(dir, dentry, mode, dev, NULL, 0, 0);
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index bce4eef91a06..62fc14ea4b73 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -186,7 +186,7 @@ static int hfs_dir_release(struct inode *inode, struct file *file)
186 * a directory and return a corresponding inode, given the inode for 186 * a directory and return a corresponding inode, given the inode for
187 * the directory and the name (and its length) of the new file. 187 * the directory and the name (and its length) of the new file.
188 */ 188 */
189static int hfs_create(struct inode *dir, struct dentry *dentry, int mode, 189static int hfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
190 struct nameidata *nd) 190 struct nameidata *nd)
191{ 191{
192 struct inode *inode; 192 struct inode *inode;
@@ -216,7 +216,7 @@ static int hfs_create(struct inode *dir, struct dentry *dentry, int mode,
216 * in a directory, given the inode for the parent directory and the 216 * in a directory, given the inode for the parent directory and the
217 * name (and its length) of the new directory. 217 * name (and its length) of the new directory.
218 */ 218 */
219static int hfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 219static int hfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
220{ 220{
221 struct inode *inode; 221 struct inode *inode;
222 int res; 222 int res;
diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h
index ad97c2d58287..1bf967c6bfdc 100644
--- a/fs/hfs/hfs_fs.h
+++ b/fs/hfs/hfs_fs.h
@@ -184,7 +184,7 @@ extern int hfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
184extern const struct address_space_operations hfs_aops; 184extern const struct address_space_operations hfs_aops;
185extern const struct address_space_operations hfs_btree_aops; 185extern const struct address_space_operations hfs_btree_aops;
186 186
187extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int); 187extern struct inode *hfs_new_inode(struct inode *, struct qstr *, umode_t);
188extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *); 188extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *);
189extern int hfs_write_inode(struct inode *, struct writeback_control *); 189extern int hfs_write_inode(struct inode *, struct writeback_control *);
190extern int hfs_inode_setattr(struct dentry *, struct iattr *); 190extern int hfs_inode_setattr(struct dentry *, struct iattr *);
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index a1a9fdcd2a00..737dbeb64320 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -169,7 +169,7 @@ const struct address_space_operations hfs_aops = {
169/* 169/*
170 * hfs_new_inode 170 * hfs_new_inode
171 */ 171 */
172struct inode *hfs_new_inode(struct inode *dir, struct qstr *name, int mode) 172struct inode *hfs_new_inode(struct inode *dir, struct qstr *name, umode_t mode)
173{ 173{
174 struct super_block *sb = dir->i_sb; 174 struct super_block *sb = dir->i_sb;
175 struct inode *inode = new_inode(sb); 175 struct inode *inode = new_inode(sb);
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 4536cd3f15ae..88e155f895c6 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -424,7 +424,7 @@ out:
424} 424}
425 425
426static int hfsplus_mknod(struct inode *dir, struct dentry *dentry, 426static int hfsplus_mknod(struct inode *dir, struct dentry *dentry,
427 int mode, dev_t rdev) 427 umode_t mode, dev_t rdev)
428{ 428{
429 struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); 429 struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
430 struct inode *inode; 430 struct inode *inode;
@@ -453,13 +453,13 @@ out:
453 return res; 453 return res;
454} 454}
455 455
456static int hfsplus_create(struct inode *dir, struct dentry *dentry, int mode, 456static int hfsplus_create(struct inode *dir, struct dentry *dentry, umode_t mode,
457 struct nameidata *nd) 457 struct nameidata *nd)
458{ 458{
459 return hfsplus_mknod(dir, dentry, mode, 0); 459 return hfsplus_mknod(dir, dentry, mode, 0);
460} 460}
461 461
462static int hfsplus_mkdir(struct inode *dir, struct dentry *dentry, int mode) 462static int hfsplus_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
463{ 463{
464 return hfsplus_mknod(dir, dentry, mode | S_IFDIR, 0); 464 return hfsplus_mknod(dir, dentry, mode | S_IFDIR, 0);
465} 465}
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index d7674d051f52..3a6c025414e2 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -402,7 +402,7 @@ void hfsplus_inode_read_fork(struct inode *, struct hfsplus_fork_raw *);
402void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *); 402void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *);
403int hfsplus_cat_read_inode(struct inode *, struct hfs_find_data *); 403int hfsplus_cat_read_inode(struct inode *, struct hfs_find_data *);
404int hfsplus_cat_write_inode(struct inode *); 404int hfsplus_cat_write_inode(struct inode *);
405struct inode *hfsplus_new_inode(struct super_block *, int); 405struct inode *hfsplus_new_inode(struct super_block *, umode_t);
406void hfsplus_delete_inode(struct inode *); 406void hfsplus_delete_inode(struct inode *);
407int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, 407int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
408 int datasync); 408 int datasync);
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 40e1413be4cf..6643b242bdd7 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -378,7 +378,7 @@ static const struct file_operations hfsplus_file_operations = {
378 .unlocked_ioctl = hfsplus_ioctl, 378 .unlocked_ioctl = hfsplus_ioctl,
379}; 379};
380 380
381struct inode *hfsplus_new_inode(struct super_block *sb, int mode) 381struct inode *hfsplus_new_inode(struct super_block *sb, umode_t mode)
382{ 382{
383 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); 383 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb);
384 struct inode *inode = new_inode(sb); 384 struct inode *inode = new_inode(sb);
diff --git a/fs/hostfs/hostfs.h b/fs/hostfs/hostfs.h
index bf15a43016b9..3cbfa93cd782 100644
--- a/fs/hostfs/hostfs.h
+++ b/fs/hostfs/hostfs.h
@@ -39,7 +39,7 @@
39 39
40struct hostfs_iattr { 40struct hostfs_iattr {
41 unsigned int ia_valid; 41 unsigned int ia_valid;
42 mode_t ia_mode; 42 unsigned short ia_mode;
43 uid_t ia_uid; 43 uid_t ia_uid;
44 gid_t ia_gid; 44 gid_t ia_gid;
45 loff_t ia_size; 45 loff_t ia_size;
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 343ea632b97c..a7340e710a90 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -551,7 +551,7 @@ static int read_name(struct inode *ino, char *name)
551 return 0; 551 return 0;
552} 552}
553 553
554int hostfs_create(struct inode *dir, struct dentry *dentry, int mode, 554int hostfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
555 struct nameidata *nd) 555 struct nameidata *nd)
556{ 556{
557 struct inode *inode; 557 struct inode *inode;
@@ -676,7 +676,7 @@ int hostfs_symlink(struct inode *ino, struct dentry *dentry, const char *to)
676 return err; 676 return err;
677} 677}
678 678
679int hostfs_mkdir(struct inode *ino, struct dentry *dentry, int mode) 679int hostfs_mkdir(struct inode *ino, struct dentry *dentry, umode_t mode)
680{ 680{
681 char *file; 681 char *file;
682 int err; 682 int err;
@@ -700,7 +700,7 @@ int hostfs_rmdir(struct inode *ino, struct dentry *dentry)
700 return err; 700 return err;
701} 701}
702 702
703int hostfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) 703static int hostfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
704{ 704{
705 struct inode *inode; 705 struct inode *inode;
706 char *name; 706 char *name;
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index ea91fcb0ef9b..30dd7b10b507 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -8,7 +8,7 @@
8#include <linux/sched.h> 8#include <linux/sched.h>
9#include "hpfs_fn.h" 9#include "hpfs_fn.h"
10 10
11static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 11static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
12{ 12{
13 const unsigned char *name = dentry->d_name.name; 13 const unsigned char *name = dentry->d_name.name;
14 unsigned len = dentry->d_name.len; 14 unsigned len = dentry->d_name.len;
@@ -115,7 +115,7 @@ bail:
115 return err; 115 return err;
116} 116}
117 117
118static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) 118static int hpfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd)
119{ 119{
120 const unsigned char *name = dentry->d_name.name; 120 const unsigned char *name = dentry->d_name.name;
121 unsigned len = dentry->d_name.len; 121 unsigned len = dentry->d_name.len;
@@ -201,7 +201,7 @@ bail:
201 return err; 201 return err;
202} 202}
203 203
204static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) 204static int hpfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev)
205{ 205{
206 const unsigned char *name = dentry->d_name.name; 206 const unsigned char *name = dentry->d_name.name;
207 unsigned len = dentry->d_name.len; 207 unsigned len = dentry->d_name.len;
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 9c4ec538725b..e425ad9d0490 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -447,8 +447,8 @@ static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr)
447 return 0; 447 return 0;
448} 448}
449 449
450static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid, 450static struct inode *hugetlbfs_get_root(struct super_block *sb,
451 gid_t gid, int mode, dev_t dev) 451 struct hugetlbfs_config *config)
452{ 452{
453 struct inode *inode; 453 struct inode *inode;
454 454
@@ -456,9 +456,31 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid,
456 if (inode) { 456 if (inode) {
457 struct hugetlbfs_inode_info *info; 457 struct hugetlbfs_inode_info *info;
458 inode->i_ino = get_next_ino(); 458 inode->i_ino = get_next_ino();
459 inode->i_mode = mode; 459 inode->i_mode = S_IFDIR | config->mode;
460 inode->i_uid = uid; 460 inode->i_uid = config->uid;
461 inode->i_gid = gid; 461 inode->i_gid = config->gid;
462 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
463 info = HUGETLBFS_I(inode);
464 mpol_shared_policy_init(&info->policy, NULL);
465 inode->i_op = &hugetlbfs_dir_inode_operations;
466 inode->i_fop = &simple_dir_operations;
467 /* directory inodes start off with i_nlink == 2 (for "." entry) */
468 inc_nlink(inode);
469 }
470 return inode;
471}
472
473static struct inode *hugetlbfs_get_inode(struct super_block *sb,
474 struct inode *dir,
475 umode_t mode, dev_t dev)
476{
477 struct inode *inode;
478
479 inode = new_inode(sb);
480 if (inode) {
481 struct hugetlbfs_inode_info *info;
482 inode->i_ino = get_next_ino();
483 inode_init_owner(inode, dir, mode);
462 inode->i_mapping->a_ops = &hugetlbfs_aops; 484 inode->i_mapping->a_ops = &hugetlbfs_aops;
463 inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info; 485 inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info;
464 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 486 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
@@ -500,20 +522,12 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid,
500 * File creation. Allocate an inode, and we're done.. 522 * File creation. Allocate an inode, and we're done..
501 */ 523 */
502static int hugetlbfs_mknod(struct inode *dir, 524static int hugetlbfs_mknod(struct inode *dir,
503 struct dentry *dentry, int mode, dev_t dev) 525 struct dentry *dentry, umode_t mode, dev_t dev)
504{ 526{
505 struct inode *inode; 527 struct inode *inode;
506 int error = -ENOSPC; 528 int error = -ENOSPC;
507 gid_t gid; 529
508 530 inode = hugetlbfs_get_inode(dir->i_sb, dir, mode, dev);
509 if (dir->i_mode & S_ISGID) {
510 gid = dir->i_gid;
511 if (S_ISDIR(mode))
512 mode |= S_ISGID;
513 } else {
514 gid = current_fsgid();
515 }
516 inode = hugetlbfs_get_inode(dir->i_sb, current_fsuid(), gid, mode, dev);
517 if (inode) { 531 if (inode) {
518 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 532 dir->i_ctime = dir->i_mtime = CURRENT_TIME;
519 d_instantiate(dentry, inode); 533 d_instantiate(dentry, inode);
@@ -523,7 +537,7 @@ static int hugetlbfs_mknod(struct inode *dir,
523 return error; 537 return error;
524} 538}
525 539
526static int hugetlbfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 540static int hugetlbfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
527{ 541{
528 int retval = hugetlbfs_mknod(dir, dentry, mode | S_IFDIR, 0); 542 int retval = hugetlbfs_mknod(dir, dentry, mode | S_IFDIR, 0);
529 if (!retval) 543 if (!retval)
@@ -531,7 +545,7 @@ static int hugetlbfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
531 return retval; 545 return retval;
532} 546}
533 547
534static int hugetlbfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) 548static int hugetlbfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd)
535{ 549{
536 return hugetlbfs_mknod(dir, dentry, mode | S_IFREG, 0); 550 return hugetlbfs_mknod(dir, dentry, mode | S_IFREG, 0);
537} 551}
@@ -541,15 +555,8 @@ static int hugetlbfs_symlink(struct inode *dir,
541{ 555{
542 struct inode *inode; 556 struct inode *inode;
543 int error = -ENOSPC; 557 int error = -ENOSPC;
544 gid_t gid;
545
546 if (dir->i_mode & S_ISGID)
547 gid = dir->i_gid;
548 else
549 gid = current_fsgid();
550 558
551 inode = hugetlbfs_get_inode(dir->i_sb, current_fsuid(), 559 inode = hugetlbfs_get_inode(dir->i_sb, dir, S_IFLNK|S_IRWXUGO, 0);
552 gid, S_IFLNK|S_IRWXUGO, 0);
553 if (inode) { 560 if (inode) {
554 int l = strlen(symname)+1; 561 int l = strlen(symname)+1;
555 error = page_symlink(inode, symname, l); 562 error = page_symlink(inode, symname, l);
@@ -857,8 +864,7 @@ hugetlbfs_fill_super(struct super_block *sb, void *data, int silent)
857 sb->s_magic = HUGETLBFS_MAGIC; 864 sb->s_magic = HUGETLBFS_MAGIC;
858 sb->s_op = &hugetlbfs_ops; 865 sb->s_op = &hugetlbfs_ops;
859 sb->s_time_gran = 1; 866 sb->s_time_gran = 1;
860 inode = hugetlbfs_get_inode(sb, config.uid, config.gid, 867 inode = hugetlbfs_get_root(sb, &config);
861 S_IFDIR | config.mode, 0);
862 if (!inode) 868 if (!inode)
863 goto out_free; 869 goto out_free;
864 870
@@ -956,8 +962,7 @@ struct file *hugetlb_file_setup(const char *name, size_t size,
956 962
957 path.mnt = mntget(hugetlbfs_vfsmount); 963 path.mnt = mntget(hugetlbfs_vfsmount);
958 error = -ENOSPC; 964 error = -ENOSPC;
959 inode = hugetlbfs_get_inode(root->d_sb, current_fsuid(), 965 inode = hugetlbfs_get_inode(root->d_sb, NULL, S_IFREG | S_IRWXUGO, 0);
960 current_fsgid(), S_IFREG | S_IRWXUGO, 0);
961 if (!inode) 966 if (!inode)
962 goto out_dentry; 967 goto out_dentry;
963 968
diff --git a/fs/inode.c b/fs/inode.c
index 24d02907e196..961355d00e38 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1646,7 +1646,7 @@ EXPORT_SYMBOL(init_special_inode);
1646 * @mode: mode of the new inode 1646 * @mode: mode of the new inode
1647 */ 1647 */
1648void inode_init_owner(struct inode *inode, const struct inode *dir, 1648void inode_init_owner(struct inode *inode, const struct inode *dir,
1649 mode_t mode) 1649 umode_t mode)
1650{ 1650{
1651 inode->i_uid = current_fsuid(); 1651 inode->i_uid = current_fsuid();
1652 if (dir && dir->i_mode & S_ISGID) { 1652 if (dir && dir->i_mode & S_ISGID) {
diff --git a/fs/internal.h b/fs/internal.h
index 7b1cb1528ac2..2523a4029452 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -15,6 +15,7 @@ struct super_block;
15struct file_system_type; 15struct file_system_type;
16struct linux_binprm; 16struct linux_binprm;
17struct path; 17struct path;
18struct mount;
18 19
19/* 20/*
20 * block_dev.c 21 * block_dev.c
@@ -46,7 +47,6 @@ extern void __init chrdev_init(void);
46extern int copy_mount_options(const void __user *, unsigned long *); 47extern int copy_mount_options(const void __user *, unsigned long *);
47extern int copy_mount_string(const void __user *, char **); 48extern int copy_mount_string(const void __user *, char **);
48 49
49extern struct vfsmount *__lookup_mnt(struct vfsmount *, struct dentry *, int);
50extern struct vfsmount *lookup_mnt(struct path *); 50extern struct vfsmount *lookup_mnt(struct path *);
51extern int finish_automount(struct vfsmount *, struct path *); 51extern int finish_automount(struct vfsmount *, struct path *);
52 52
@@ -88,7 +88,7 @@ extern struct file *nameidata_to_filp(struct nameidata *);
88extern void release_open_intent(struct nameidata *); 88extern void release_open_intent(struct nameidata *);
89struct open_flags { 89struct open_flags {
90 int open_flag; 90 int open_flag;
91 int mode; 91 umode_t mode;
92 int acc_mode; 92 int acc_mode;
93 int intent; 93 int intent;
94}; 94};
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index b71f6311a337..7b99f5f460be 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -169,8 +169,8 @@ struct iso9660_options{
169 unsigned char map; 169 unsigned char map;
170 unsigned char check; 170 unsigned char check;
171 unsigned int blocksize; 171 unsigned int blocksize;
172 mode_t fmode; 172 umode_t fmode;
173 mode_t dmode; 173 umode_t dmode;
174 gid_t gid; 174 gid_t gid;
175 uid_t uid; 175 uid_t uid;
176 char *iocharset; 176 char *iocharset;
diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h
index 7d33de84f52a..0e73f63d9274 100644
--- a/fs/isofs/isofs.h
+++ b/fs/isofs/isofs.h
@@ -50,14 +50,14 @@ struct isofs_sb_info {
50 unsigned int s_uid_set:1; 50 unsigned int s_uid_set:1;
51 unsigned int s_gid_set:1; 51 unsigned int s_gid_set:1;
52 52
53 mode_t s_fmode; 53 umode_t s_fmode;
54 mode_t s_dmode; 54 umode_t s_dmode;
55 gid_t s_gid; 55 gid_t s_gid;
56 uid_t s_uid; 56 uid_t s_uid;
57 struct nls_table *s_nls_iocharset; /* Native language support table */ 57 struct nls_table *s_nls_iocharset; /* Native language support table */
58}; 58};
59 59
60#define ISOFS_INVALID_MODE ((mode_t) -1) 60#define ISOFS_INVALID_MODE ((umode_t) -1)
61 61
62static inline struct isofs_sb_info *ISOFS_SB(struct super_block *sb) 62static inline struct isofs_sb_info *ISOFS_SB(struct super_block *sb)
63{ 63{
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index be6169bd8acd..973ac5822bd7 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -22,16 +22,16 @@
22 22
23static int jffs2_readdir (struct file *, void *, filldir_t); 23static int jffs2_readdir (struct file *, void *, filldir_t);
24 24
25static int jffs2_create (struct inode *,struct dentry *,int, 25static int jffs2_create (struct inode *,struct dentry *,umode_t,
26 struct nameidata *); 26 struct nameidata *);
27static struct dentry *jffs2_lookup (struct inode *,struct dentry *, 27static struct dentry *jffs2_lookup (struct inode *,struct dentry *,
28 struct nameidata *); 28 struct nameidata *);
29static int jffs2_link (struct dentry *,struct inode *,struct dentry *); 29static int jffs2_link (struct dentry *,struct inode *,struct dentry *);
30static int jffs2_unlink (struct inode *,struct dentry *); 30static int jffs2_unlink (struct inode *,struct dentry *);
31static int jffs2_symlink (struct inode *,struct dentry *,const char *); 31static int jffs2_symlink (struct inode *,struct dentry *,const char *);
32static int jffs2_mkdir (struct inode *,struct dentry *,int); 32static int jffs2_mkdir (struct inode *,struct dentry *,umode_t);
33static int jffs2_rmdir (struct inode *,struct dentry *); 33static int jffs2_rmdir (struct inode *,struct dentry *);
34static int jffs2_mknod (struct inode *,struct dentry *,int,dev_t); 34static int jffs2_mknod (struct inode *,struct dentry *,umode_t,dev_t);
35static int jffs2_rename (struct inode *, struct dentry *, 35static int jffs2_rename (struct inode *, struct dentry *,
36 struct inode *, struct dentry *); 36 struct inode *, struct dentry *);
37 37
@@ -169,8 +169,8 @@ static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir)
169/***********************************************************************/ 169/***********************************************************************/
170 170
171 171
172static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode, 172static int jffs2_create(struct inode *dir_i, struct dentry *dentry,
173 struct nameidata *nd) 173 umode_t mode, struct nameidata *nd)
174{ 174{
175 struct jffs2_raw_inode *ri; 175 struct jffs2_raw_inode *ri;
176 struct jffs2_inode_info *f, *dir_f; 176 struct jffs2_inode_info *f, *dir_f;
@@ -450,7 +450,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
450} 450}
451 451
452 452
453static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode) 453static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, umode_t mode)
454{ 454{
455 struct jffs2_inode_info *f, *dir_f; 455 struct jffs2_inode_info *f, *dir_f;
456 struct jffs2_sb_info *c; 456 struct jffs2_sb_info *c;
@@ -618,7 +618,7 @@ static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry)
618 return ret; 618 return ret;
619} 619}
620 620
621static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, dev_t rdev) 621static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode, dev_t rdev)
622{ 622{
623 struct jffs2_inode_info *f, *dir_f; 623 struct jffs2_inode_info *f, *dir_f;
624 struct jffs2_sb_info *c; 624 struct jffs2_sb_info *c;
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index a112ad96e474..5f7c160ea64f 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -72,7 +72,7 @@ static inline void free_ea_wmap(struct inode *inode)
72 * RETURN: Errors from subroutines 72 * RETURN: Errors from subroutines
73 * 73 *
74 */ 74 */
75static int jfs_create(struct inode *dip, struct dentry *dentry, int mode, 75static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode,
76 struct nameidata *nd) 76 struct nameidata *nd)
77{ 77{
78 int rc = 0; 78 int rc = 0;
@@ -205,7 +205,7 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
205 * note: 205 * note:
206 * EACCESS: user needs search+write permission on the parent directory 206 * EACCESS: user needs search+write permission on the parent directory
207 */ 207 */
208static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode) 208static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
209{ 209{
210 int rc = 0; 210 int rc = 0;
211 tid_t tid; /* transaction id */ 211 tid_t tid; /* transaction id */
@@ -1353,7 +1353,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1353 * FUNCTION: Create a special file (device) 1353 * FUNCTION: Create a special file (device)
1354 */ 1354 */
1355static int jfs_mknod(struct inode *dir, struct dentry *dentry, 1355static int jfs_mknod(struct inode *dir, struct dentry *dentry,
1356 int mode, dev_t rdev) 1356 umode_t mode, dev_t rdev)
1357{ 1357{
1358 struct jfs_inode_info *jfs_ip; 1358 struct jfs_inode_info *jfs_ip;
1359 struct btstack btstack; 1359 struct btstack btstack;
diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c
index b7d7f67cee5a..501043e8966c 100644
--- a/fs/logfs/dir.c
+++ b/fs/logfs/dir.c
@@ -482,7 +482,7 @@ out:
482 return ret; 482 return ret;
483} 483}
484 484
485static int logfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 485static int logfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
486{ 486{
487 struct inode *inode; 487 struct inode *inode;
488 488
@@ -501,7 +501,7 @@ static int logfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
501 return __logfs_create(dir, dentry, inode, NULL, 0); 501 return __logfs_create(dir, dentry, inode, NULL, 0);
502} 502}
503 503
504static int logfs_create(struct inode *dir, struct dentry *dentry, int mode, 504static int logfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
505 struct nameidata *nd) 505 struct nameidata *nd)
506{ 506{
507 struct inode *inode; 507 struct inode *inode;
@@ -517,7 +517,7 @@ static int logfs_create(struct inode *dir, struct dentry *dentry, int mode,
517 return __logfs_create(dir, dentry, inode, NULL, 0); 517 return __logfs_create(dir, dentry, inode, NULL, 0);
518} 518}
519 519
520static int logfs_mknod(struct inode *dir, struct dentry *dentry, int mode, 520static int logfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
521 dev_t rdev) 521 dev_t rdev)
522{ 522{
523 struct inode *inode; 523 struct inode *inode;
diff --git a/fs/logfs/inode.c b/fs/logfs/inode.c
index 4d1af42bfd24..388df1aa35e5 100644
--- a/fs/logfs/inode.c
+++ b/fs/logfs/inode.c
@@ -323,7 +323,7 @@ static void logfs_set_ino_generation(struct super_block *sb,
323 mutex_unlock(&super->s_journal_mutex); 323 mutex_unlock(&super->s_journal_mutex);
324} 324}
325 325
326struct inode *logfs_new_inode(struct inode *dir, int mode) 326struct inode *logfs_new_inode(struct inode *dir, umode_t mode)
327{ 327{
328 struct super_block *sb = dir->i_sb; 328 struct super_block *sb = dir->i_sb;
329 struct inode *inode; 329 struct inode *inode;
diff --git a/fs/logfs/logfs.h b/fs/logfs/logfs.h
index 398ecff6e548..926373866a55 100644
--- a/fs/logfs/logfs.h
+++ b/fs/logfs/logfs.h
@@ -520,7 +520,7 @@ extern const struct super_operations logfs_super_operations;
520struct inode *logfs_iget(struct super_block *sb, ino_t ino); 520struct inode *logfs_iget(struct super_block *sb, ino_t ino);
521struct inode *logfs_safe_iget(struct super_block *sb, ino_t ino, int *cookie); 521struct inode *logfs_safe_iget(struct super_block *sb, ino_t ino, int *cookie);
522void logfs_safe_iput(struct inode *inode, int cookie); 522void logfs_safe_iput(struct inode *inode, int cookie);
523struct inode *logfs_new_inode(struct inode *dir, int mode); 523struct inode *logfs_new_inode(struct inode *dir, umode_t mode);
524struct inode *logfs_new_meta_inode(struct super_block *sb, u64 ino); 524struct inode *logfs_new_meta_inode(struct super_block *sb, u64 ino);
525struct inode *logfs_read_meta_inode(struct super_block *sb, u64 ino); 525struct inode *logfs_read_meta_inode(struct super_block *sb, u64 ino);
526int logfs_init_inode_cache(void); 526int logfs_init_inode_cache(void);
diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c
index ef175cb8cfd8..4bc50dac8e97 100644
--- a/fs/minix/bitmap.c
+++ b/fs/minix/bitmap.c
@@ -209,7 +209,7 @@ void minix_free_inode(struct inode * inode)
209 mark_buffer_dirty(bh); 209 mark_buffer_dirty(bh);
210} 210}
211 211
212struct inode *minix_new_inode(const struct inode *dir, int mode, int *error) 212struct inode *minix_new_inode(const struct inode *dir, umode_t mode, int *error)
213{ 213{
214 struct super_block *sb = dir->i_sb; 214 struct super_block *sb = dir->i_sb;
215 struct minix_sb_info *sbi = minix_sb(sb); 215 struct minix_sb_info *sbi = minix_sb(sb);
diff --git a/fs/minix/minix.h b/fs/minix/minix.h
index 26bbd55e82ea..c889ef0aa571 100644
--- a/fs/minix/minix.h
+++ b/fs/minix/minix.h
@@ -46,7 +46,7 @@ struct minix_sb_info {
46extern struct inode *minix_iget(struct super_block *, unsigned long); 46extern struct inode *minix_iget(struct super_block *, unsigned long);
47extern struct minix_inode * minix_V1_raw_inode(struct super_block *, ino_t, struct buffer_head **); 47extern struct minix_inode * minix_V1_raw_inode(struct super_block *, ino_t, struct buffer_head **);
48extern struct minix2_inode * minix_V2_raw_inode(struct super_block *, ino_t, struct buffer_head **); 48extern struct minix2_inode * minix_V2_raw_inode(struct super_block *, ino_t, struct buffer_head **);
49extern struct inode * minix_new_inode(const struct inode *, int, int *); 49extern struct inode * minix_new_inode(const struct inode *, umode_t, int *);
50extern void minix_free_inode(struct inode * inode); 50extern void minix_free_inode(struct inode * inode);
51extern unsigned long minix_count_free_inodes(struct super_block *sb); 51extern unsigned long minix_count_free_inodes(struct super_block *sb);
52extern int minix_new_block(struct inode * inode); 52extern int minix_new_block(struct inode * inode);
diff --git a/fs/minix/namei.c b/fs/minix/namei.c
index 6e6777f1b4b2..2f76e38c2065 100644
--- a/fs/minix/namei.c
+++ b/fs/minix/namei.c
@@ -36,7 +36,7 @@ static struct dentry *minix_lookup(struct inode * dir, struct dentry *dentry, st
36 return NULL; 36 return NULL;
37} 37}
38 38
39static int minix_mknod(struct inode * dir, struct dentry *dentry, int mode, dev_t rdev) 39static int minix_mknod(struct inode * dir, struct dentry *dentry, umode_t mode, dev_t rdev)
40{ 40{
41 int error; 41 int error;
42 struct inode *inode; 42 struct inode *inode;
@@ -54,7 +54,7 @@ static int minix_mknod(struct inode * dir, struct dentry *dentry, int mode, dev_
54 return error; 54 return error;
55} 55}
56 56
57static int minix_create(struct inode * dir, struct dentry *dentry, int mode, 57static int minix_create(struct inode *dir, struct dentry *dentry, umode_t mode,
58 struct nameidata *nd) 58 struct nameidata *nd)
59{ 59{
60 return minix_mknod(dir, dentry, mode, 0); 60 return minix_mknod(dir, dentry, mode, 0);
@@ -103,7 +103,7 @@ static int minix_link(struct dentry * old_dentry, struct inode * dir,
103 return add_nondir(dentry, inode); 103 return add_nondir(dentry, inode);
104} 104}
105 105
106static int minix_mkdir(struct inode * dir, struct dentry *dentry, int mode) 106static int minix_mkdir(struct inode * dir, struct dentry *dentry, umode_t mode)
107{ 107{
108 struct inode * inode; 108 struct inode * inode;
109 int err = -EMLINK; 109 int err = -EMLINK;
diff --git a/fs/mount.h b/fs/mount.h
index 7890e49f74ef..0921b51e27e2 100644
--- a/fs/mount.h
+++ b/fs/mount.h
@@ -1,6 +1,75 @@
1#include <linux/mount.h> 1#include <linux/mount.h>
2#include <linux/seq_file.h>
3#include <linux/poll.h>
2 4
3static inline int mnt_has_parent(struct vfsmount *mnt) 5struct mnt_namespace {
6 atomic_t count;
7 struct mount * root;
8 struct list_head list;
9 wait_queue_head_t poll;
10 int event;
11};
12
13struct mnt_pcp {
14 int mnt_count;
15 int mnt_writers;
16};
17
18struct mount {
19 struct list_head mnt_hash;
20 struct mount *mnt_parent;
21 struct dentry *mnt_mountpoint;
22 struct vfsmount mnt;
23#ifdef CONFIG_SMP
24 struct mnt_pcp __percpu *mnt_pcp;
25 atomic_t mnt_longterm; /* how many of the refs are longterm */
26#else
27 int mnt_count;
28 int mnt_writers;
29#endif
30 struct list_head mnt_mounts; /* list of children, anchored here */
31 struct list_head mnt_child; /* and going through their mnt_child */
32 const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
33 struct list_head mnt_list;
34 struct list_head mnt_expire; /* link in fs-specific expiry list */
35 struct list_head mnt_share; /* circular list of shared mounts */
36 struct list_head mnt_slave_list;/* list of slave mounts */
37 struct list_head mnt_slave; /* slave list entry */
38 struct mount *mnt_master; /* slave is on master->mnt_slave_list */
39 struct mnt_namespace *mnt_ns; /* containing namespace */
40#ifdef CONFIG_FSNOTIFY
41 struct hlist_head mnt_fsnotify_marks;
42 __u32 mnt_fsnotify_mask;
43#endif
44 int mnt_id; /* mount identifier */
45 int mnt_group_id; /* peer group identifier */
46 int mnt_expiry_mark; /* true if marked for expiry */
47 int mnt_pinned;
48 int mnt_ghosts;
49};
50
51static inline struct mount *real_mount(struct vfsmount *mnt)
52{
53 return container_of(mnt, struct mount, mnt);
54}
55
56static inline int mnt_has_parent(struct mount *mnt)
4{ 57{
5 return mnt != mnt->mnt_parent; 58 return mnt != mnt->mnt_parent;
6} 59}
60
61extern struct mount *__lookup_mnt(struct vfsmount *, struct dentry *, int);
62
63static inline void get_mnt_ns(struct mnt_namespace *ns)
64{
65 atomic_inc(&ns->count);
66}
67
68struct proc_mounts {
69 struct seq_file m; /* must be the first element */
70 struct mnt_namespace *ns;
71 struct path root;
72 int (*show)(struct seq_file *, struct vfsmount *);
73};
74
75extern const struct seq_operations mounts_op;
diff --git a/fs/namei.c b/fs/namei.c
index 5008f01787f5..c283a1ec008e 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -36,6 +36,7 @@
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37 37
38#include "internal.h" 38#include "internal.h"
39#include "mount.h"
39 40
40/* [Feb-1997 T. Schoebel-Theuer] 41/* [Feb-1997 T. Schoebel-Theuer]
41 * Fundamental changes in the pathname lookup mechanisms (namei) 42 * Fundamental changes in the pathname lookup mechanisms (namei)
@@ -676,36 +677,38 @@ follow_link(struct path *link, struct nameidata *nd, void **p)
676 677
677static int follow_up_rcu(struct path *path) 678static int follow_up_rcu(struct path *path)
678{ 679{
679 struct vfsmount *parent; 680 struct mount *mnt = real_mount(path->mnt);
681 struct mount *parent;
680 struct dentry *mountpoint; 682 struct dentry *mountpoint;
681 683
682 parent = path->mnt->mnt_parent; 684 parent = mnt->mnt_parent;
683 if (parent == path->mnt) 685 if (&parent->mnt == path->mnt)
684 return 0; 686 return 0;
685 mountpoint = path->mnt->mnt_mountpoint; 687 mountpoint = mnt->mnt_mountpoint;
686 path->dentry = mountpoint; 688 path->dentry = mountpoint;
687 path->mnt = parent; 689 path->mnt = &parent->mnt;
688 return 1; 690 return 1;
689} 691}
690 692
691int follow_up(struct path *path) 693int follow_up(struct path *path)
692{ 694{
693 struct vfsmount *parent; 695 struct mount *mnt = real_mount(path->mnt);
696 struct mount *parent;
694 struct dentry *mountpoint; 697 struct dentry *mountpoint;
695 698
696 br_read_lock(vfsmount_lock); 699 br_read_lock(vfsmount_lock);
697 parent = path->mnt->mnt_parent; 700 parent = mnt->mnt_parent;
698 if (parent == path->mnt) { 701 if (&parent->mnt == path->mnt) {
699 br_read_unlock(vfsmount_lock); 702 br_read_unlock(vfsmount_lock);
700 return 0; 703 return 0;
701 } 704 }
702 mntget(parent); 705 mntget(&parent->mnt);
703 mountpoint = dget(path->mnt->mnt_mountpoint); 706 mountpoint = dget(mnt->mnt_mountpoint);
704 br_read_unlock(vfsmount_lock); 707 br_read_unlock(vfsmount_lock);
705 dput(path->dentry); 708 dput(path->dentry);
706 path->dentry = mountpoint; 709 path->dentry = mountpoint;
707 mntput(path->mnt); 710 mntput(path->mnt);
708 path->mnt = parent; 711 path->mnt = &parent->mnt;
709 return 1; 712 return 1;
710} 713}
711 714
@@ -884,7 +887,7 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path,
884 struct inode **inode) 887 struct inode **inode)
885{ 888{
886 for (;;) { 889 for (;;) {
887 struct vfsmount *mounted; 890 struct mount *mounted;
888 /* 891 /*
889 * Don't forget we might have a non-mountpoint managed dentry 892 * Don't forget we might have a non-mountpoint managed dentry
890 * that wants to block transit. 893 * that wants to block transit.
@@ -898,8 +901,8 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path,
898 mounted = __lookup_mnt(path->mnt, path->dentry, 1); 901 mounted = __lookup_mnt(path->mnt, path->dentry, 1);
899 if (!mounted) 902 if (!mounted)
900 break; 903 break;
901 path->mnt = mounted; 904 path->mnt = &mounted->mnt;
902 path->dentry = mounted->mnt_root; 905 path->dentry = mounted->mnt.mnt_root;
903 nd->flags |= LOOKUP_JUMPED; 906 nd->flags |= LOOKUP_JUMPED;
904 nd->seq = read_seqcount_begin(&path->dentry->d_seq); 907 nd->seq = read_seqcount_begin(&path->dentry->d_seq);
905 /* 908 /*
@@ -915,12 +918,12 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path,
915static void follow_mount_rcu(struct nameidata *nd) 918static void follow_mount_rcu(struct nameidata *nd)
916{ 919{
917 while (d_mountpoint(nd->path.dentry)) { 920 while (d_mountpoint(nd->path.dentry)) {
918 struct vfsmount *mounted; 921 struct mount *mounted;
919 mounted = __lookup_mnt(nd->path.mnt, nd->path.dentry, 1); 922 mounted = __lookup_mnt(nd->path.mnt, nd->path.dentry, 1);
920 if (!mounted) 923 if (!mounted)
921 break; 924 break;
922 nd->path.mnt = mounted; 925 nd->path.mnt = &mounted->mnt;
923 nd->path.dentry = mounted->mnt_root; 926 nd->path.dentry = mounted->mnt.mnt_root;
924 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); 927 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq);
925 } 928 }
926} 929}
@@ -1976,7 +1979,7 @@ void unlock_rename(struct dentry *p1, struct dentry *p2)
1976 } 1979 }
1977} 1980}
1978 1981
1979int vfs_create(struct inode *dir, struct dentry *dentry, int mode, 1982int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
1980 struct nameidata *nd) 1983 struct nameidata *nd)
1981{ 1984{
1982 int error = may_create(dir, dentry); 1985 int error = may_create(dir, dentry);
@@ -2177,7 +2180,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
2177 2180
2178 /* Negative dentry, just create the file */ 2181 /* Negative dentry, just create the file */
2179 if (!dentry->d_inode) { 2182 if (!dentry->d_inode) {
2180 int mode = op->mode; 2183 umode_t mode = op->mode;
2181 if (!IS_POSIXACL(dir->d_inode)) 2184 if (!IS_POSIXACL(dir->d_inode))
2182 mode &= ~current_umask(); 2185 mode &= ~current_umask();
2183 /* 2186 /*
@@ -2444,7 +2447,7 @@ struct dentry *user_path_create(int dfd, const char __user *pathname, struct pat
2444} 2447}
2445EXPORT_SYMBOL(user_path_create); 2448EXPORT_SYMBOL(user_path_create);
2446 2449
2447int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) 2450int vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
2448{ 2451{
2449 int error = may_create(dir, dentry); 2452 int error = may_create(dir, dentry);
2450 2453
@@ -2472,7 +2475,7 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
2472 return error; 2475 return error;
2473} 2476}
2474 2477
2475static int may_mknod(mode_t mode) 2478static int may_mknod(umode_t mode)
2476{ 2479{
2477 switch (mode & S_IFMT) { 2480 switch (mode & S_IFMT) {
2478 case S_IFREG: 2481 case S_IFREG:
@@ -2489,7 +2492,7 @@ static int may_mknod(mode_t mode)
2489 } 2492 }
2490} 2493}
2491 2494
2492SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, int, mode, 2495SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, umode_t, mode,
2493 unsigned, dev) 2496 unsigned, dev)
2494{ 2497{
2495 struct dentry *dentry; 2498 struct dentry *dentry;
@@ -2536,12 +2539,12 @@ out_dput:
2536 return error; 2539 return error;
2537} 2540}
2538 2541
2539SYSCALL_DEFINE3(mknod, const char __user *, filename, int, mode, unsigned, dev) 2542SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, dev)
2540{ 2543{
2541 return sys_mknodat(AT_FDCWD, filename, mode, dev); 2544 return sys_mknodat(AT_FDCWD, filename, mode, dev);
2542} 2545}
2543 2546
2544int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 2547int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
2545{ 2548{
2546 int error = may_create(dir, dentry); 2549 int error = may_create(dir, dentry);
2547 2550
@@ -2562,7 +2565,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
2562 return error; 2565 return error;
2563} 2566}
2564 2567
2565SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, int, mode) 2568SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, umode_t, mode)
2566{ 2569{
2567 struct dentry *dentry; 2570 struct dentry *dentry;
2568 struct path path; 2571 struct path path;
@@ -2590,7 +2593,7 @@ out_dput:
2590 return error; 2593 return error;
2591} 2594}
2592 2595
2593SYSCALL_DEFINE2(mkdir, const char __user *, pathname, int, mode) 2596SYSCALL_DEFINE2(mkdir, const char __user *, pathname, umode_t, mode)
2594{ 2597{
2595 return sys_mkdirat(AT_FDCWD, pathname, mode); 2598 return sys_mkdirat(AT_FDCWD, pathname, mode);
2596} 2599}
diff --git a/fs/namespace.c b/fs/namespace.c
index 86b4f6406470..773435ca300d 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -9,30 +9,17 @@
9 */ 9 */
10 10
11#include <linux/syscalls.h> 11#include <linux/syscalls.h>
12#include <linux/slab.h> 12#include <linux/export.h>
13#include <linux/sched.h>
14#include <linux/spinlock.h>
15#include <linux/percpu.h>
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/acct.h>
19#include <linux/capability.h> 13#include <linux/capability.h>
20#include <linux/cpumask.h>
21#include <linux/module.h>
22#include <linux/sysfs.h>
23#include <linux/seq_file.h>
24#include <linux/mnt_namespace.h> 14#include <linux/mnt_namespace.h>
25#include <linux/namei.h> 15#include <linux/namei.h>
26#include <linux/nsproxy.h>
27#include <linux/security.h> 16#include <linux/security.h>
28#include <linux/mount.h>
29#include <linux/ramfs.h>
30#include <linux/log2.h>
31#include <linux/idr.h> 17#include <linux/idr.h>
32#include <linux/fs_struct.h> 18#include <linux/acct.h> /* acct_auto_close_mnt */
33#include <linux/fsnotify.h> 19#include <linux/ramfs.h> /* init_rootfs */
34#include <asm/uaccess.h> 20#include <linux/fs_struct.h> /* get_fs_root et.al. */
35#include <asm/unistd.h> 21#include <linux/fsnotify.h> /* fsnotify_vfsmount_delete */
22#include <linux/uaccess.h>
36#include "pnode.h" 23#include "pnode.h"
37#include "internal.h" 24#include "internal.h"
38 25
@@ -78,7 +65,7 @@ static inline unsigned long hash(struct vfsmount *mnt, struct dentry *dentry)
78 * allocation is serialized by namespace_sem, but we need the spinlock to 65 * allocation is serialized by namespace_sem, but we need the spinlock to
79 * serialize with freeing. 66 * serialize with freeing.
80 */ 67 */
81static int mnt_alloc_id(struct vfsmount *mnt) 68static int mnt_alloc_id(struct mount *mnt)
82{ 69{
83 int res; 70 int res;
84 71
@@ -95,7 +82,7 @@ retry:
95 return res; 82 return res;
96} 83}
97 84
98static void mnt_free_id(struct vfsmount *mnt) 85static void mnt_free_id(struct mount *mnt)
99{ 86{
100 int id = mnt->mnt_id; 87 int id = mnt->mnt_id;
101 spin_lock(&mnt_id_lock); 88 spin_lock(&mnt_id_lock);
@@ -110,7 +97,7 @@ static void mnt_free_id(struct vfsmount *mnt)
110 * 97 *
111 * mnt_group_ida is protected by namespace_sem 98 * mnt_group_ida is protected by namespace_sem
112 */ 99 */
113static int mnt_alloc_group_id(struct vfsmount *mnt) 100static int mnt_alloc_group_id(struct mount *mnt)
114{ 101{
115 int res; 102 int res;
116 103
@@ -129,7 +116,7 @@ static int mnt_alloc_group_id(struct vfsmount *mnt)
129/* 116/*
130 * Release a peer group ID 117 * Release a peer group ID
131 */ 118 */
132void mnt_release_group_id(struct vfsmount *mnt) 119void mnt_release_group_id(struct mount *mnt)
133{ 120{
134 int id = mnt->mnt_group_id; 121 int id = mnt->mnt_group_id;
135 ida_remove(&mnt_group_ida, id); 122 ida_remove(&mnt_group_ida, id);
@@ -141,7 +128,7 @@ void mnt_release_group_id(struct vfsmount *mnt)
141/* 128/*
142 * vfsmount lock must be held for read 129 * vfsmount lock must be held for read
143 */ 130 */
144static inline void mnt_add_count(struct vfsmount *mnt, int n) 131static inline void mnt_add_count(struct mount *mnt, int n)
145{ 132{
146#ifdef CONFIG_SMP 133#ifdef CONFIG_SMP
147 this_cpu_add(mnt->mnt_pcp->mnt_count, n); 134 this_cpu_add(mnt->mnt_pcp->mnt_count, n);
@@ -155,7 +142,7 @@ static inline void mnt_add_count(struct vfsmount *mnt, int n)
155/* 142/*
156 * vfsmount lock must be held for write 143 * vfsmount lock must be held for write
157 */ 144 */
158unsigned int mnt_get_count(struct vfsmount *mnt) 145unsigned int mnt_get_count(struct mount *mnt)
159{ 146{
160#ifdef CONFIG_SMP 147#ifdef CONFIG_SMP
161 unsigned int count = 0; 148 unsigned int count = 0;
@@ -171,9 +158,9 @@ unsigned int mnt_get_count(struct vfsmount *mnt)
171#endif 158#endif
172} 159}
173 160
174static struct vfsmount *alloc_vfsmnt(const char *name) 161static struct mount *alloc_vfsmnt(const char *name)
175{ 162{
176 struct vfsmount *mnt = kmem_cache_zalloc(mnt_cache, GFP_KERNEL); 163 struct mount *mnt = kmem_cache_zalloc(mnt_cache, GFP_KERNEL);
177 if (mnt) { 164 if (mnt) {
178 int err; 165 int err;
179 166
@@ -252,7 +239,7 @@ int __mnt_is_readonly(struct vfsmount *mnt)
252} 239}
253EXPORT_SYMBOL_GPL(__mnt_is_readonly); 240EXPORT_SYMBOL_GPL(__mnt_is_readonly);
254 241
255static inline void mnt_inc_writers(struct vfsmount *mnt) 242static inline void mnt_inc_writers(struct mount *mnt)
256{ 243{
257#ifdef CONFIG_SMP 244#ifdef CONFIG_SMP
258 this_cpu_inc(mnt->mnt_pcp->mnt_writers); 245 this_cpu_inc(mnt->mnt_pcp->mnt_writers);
@@ -261,7 +248,7 @@ static inline void mnt_inc_writers(struct vfsmount *mnt)
261#endif 248#endif
262} 249}
263 250
264static inline void mnt_dec_writers(struct vfsmount *mnt) 251static inline void mnt_dec_writers(struct mount *mnt)
265{ 252{
266#ifdef CONFIG_SMP 253#ifdef CONFIG_SMP
267 this_cpu_dec(mnt->mnt_pcp->mnt_writers); 254 this_cpu_dec(mnt->mnt_pcp->mnt_writers);
@@ -270,7 +257,7 @@ static inline void mnt_dec_writers(struct vfsmount *mnt)
270#endif 257#endif
271} 258}
272 259
273static unsigned int mnt_get_writers(struct vfsmount *mnt) 260static unsigned int mnt_get_writers(struct mount *mnt)
274{ 261{
275#ifdef CONFIG_SMP 262#ifdef CONFIG_SMP
276 unsigned int count = 0; 263 unsigned int count = 0;
@@ -296,7 +283,7 @@ static unsigned int mnt_get_writers(struct vfsmount *mnt)
296 */ 283 */
297/** 284/**
298 * mnt_want_write - get write access to a mount 285 * mnt_want_write - get write access to a mount
299 * @mnt: the mount on which to take a write 286 * @m: the mount on which to take a write
300 * 287 *
301 * This tells the low-level filesystem that a write is 288 * This tells the low-level filesystem that a write is
302 * about to be performed to it, and makes sure that 289 * about to be performed to it, and makes sure that
@@ -304,8 +291,9 @@ static unsigned int mnt_get_writers(struct vfsmount *mnt)
304 * the write operation is finished, mnt_drop_write() 291 * the write operation is finished, mnt_drop_write()
305 * must be called. This is effectively a refcount. 292 * must be called. This is effectively a refcount.
306 */ 293 */
307int mnt_want_write(struct vfsmount *mnt) 294int mnt_want_write(struct vfsmount *m)
308{ 295{
296 struct mount *mnt = real_mount(m);
309 int ret = 0; 297 int ret = 0;
310 298
311 preempt_disable(); 299 preempt_disable();
@@ -316,7 +304,7 @@ int mnt_want_write(struct vfsmount *mnt)
316 * incremented count after it has set MNT_WRITE_HOLD. 304 * incremented count after it has set MNT_WRITE_HOLD.
317 */ 305 */
318 smp_mb(); 306 smp_mb();
319 while (mnt->mnt_flags & MNT_WRITE_HOLD) 307 while (mnt->mnt.mnt_flags & MNT_WRITE_HOLD)
320 cpu_relax(); 308 cpu_relax();
321 /* 309 /*
322 * After the slowpath clears MNT_WRITE_HOLD, mnt_is_readonly will 310 * After the slowpath clears MNT_WRITE_HOLD, mnt_is_readonly will
@@ -324,7 +312,7 @@ int mnt_want_write(struct vfsmount *mnt)
324 * MNT_WRITE_HOLD is cleared. 312 * MNT_WRITE_HOLD is cleared.
325 */ 313 */
326 smp_rmb(); 314 smp_rmb();
327 if (__mnt_is_readonly(mnt)) { 315 if (__mnt_is_readonly(m)) {
328 mnt_dec_writers(mnt); 316 mnt_dec_writers(mnt);
329 ret = -EROFS; 317 ret = -EROFS;
330 goto out; 318 goto out;
@@ -353,7 +341,7 @@ int mnt_clone_write(struct vfsmount *mnt)
353 if (__mnt_is_readonly(mnt)) 341 if (__mnt_is_readonly(mnt))
354 return -EROFS; 342 return -EROFS;
355 preempt_disable(); 343 preempt_disable();
356 mnt_inc_writers(mnt); 344 mnt_inc_writers(real_mount(mnt));
357 preempt_enable(); 345 preempt_enable();
358 return 0; 346 return 0;
359} 347}
@@ -387,7 +375,7 @@ EXPORT_SYMBOL_GPL(mnt_want_write_file);
387void mnt_drop_write(struct vfsmount *mnt) 375void mnt_drop_write(struct vfsmount *mnt)
388{ 376{
389 preempt_disable(); 377 preempt_disable();
390 mnt_dec_writers(mnt); 378 mnt_dec_writers(real_mount(mnt));
391 preempt_enable(); 379 preempt_enable();
392} 380}
393EXPORT_SYMBOL_GPL(mnt_drop_write); 381EXPORT_SYMBOL_GPL(mnt_drop_write);
@@ -398,12 +386,12 @@ void mnt_drop_write_file(struct file *file)
398} 386}
399EXPORT_SYMBOL(mnt_drop_write_file); 387EXPORT_SYMBOL(mnt_drop_write_file);
400 388
401static int mnt_make_readonly(struct vfsmount *mnt) 389static int mnt_make_readonly(struct mount *mnt)
402{ 390{
403 int ret = 0; 391 int ret = 0;
404 392
405 br_write_lock(vfsmount_lock); 393 br_write_lock(vfsmount_lock);
406 mnt->mnt_flags |= MNT_WRITE_HOLD; 394 mnt->mnt.mnt_flags |= MNT_WRITE_HOLD;
407 /* 395 /*
408 * After storing MNT_WRITE_HOLD, we'll read the counters. This store 396 * After storing MNT_WRITE_HOLD, we'll read the counters. This store
409 * should be visible before we do. 397 * should be visible before we do.
@@ -429,25 +417,25 @@ static int mnt_make_readonly(struct vfsmount *mnt)
429 if (mnt_get_writers(mnt) > 0) 417 if (mnt_get_writers(mnt) > 0)
430 ret = -EBUSY; 418 ret = -EBUSY;
431 else 419 else
432 mnt->mnt_flags |= MNT_READONLY; 420 mnt->mnt.mnt_flags |= MNT_READONLY;
433 /* 421 /*
434 * MNT_READONLY must become visible before ~MNT_WRITE_HOLD, so writers 422 * MNT_READONLY must become visible before ~MNT_WRITE_HOLD, so writers
435 * that become unheld will see MNT_READONLY. 423 * that become unheld will see MNT_READONLY.
436 */ 424 */
437 smp_wmb(); 425 smp_wmb();
438 mnt->mnt_flags &= ~MNT_WRITE_HOLD; 426 mnt->mnt.mnt_flags &= ~MNT_WRITE_HOLD;
439 br_write_unlock(vfsmount_lock); 427 br_write_unlock(vfsmount_lock);
440 return ret; 428 return ret;
441} 429}
442 430
443static void __mnt_unmake_readonly(struct vfsmount *mnt) 431static void __mnt_unmake_readonly(struct mount *mnt)
444{ 432{
445 br_write_lock(vfsmount_lock); 433 br_write_lock(vfsmount_lock);
446 mnt->mnt_flags &= ~MNT_READONLY; 434 mnt->mnt.mnt_flags &= ~MNT_READONLY;
447 br_write_unlock(vfsmount_lock); 435 br_write_unlock(vfsmount_lock);
448} 436}
449 437
450static void free_vfsmnt(struct vfsmount *mnt) 438static void free_vfsmnt(struct mount *mnt)
451{ 439{
452 kfree(mnt->mnt_devname); 440 kfree(mnt->mnt_devname);
453 mnt_free_id(mnt); 441 mnt_free_id(mnt);
@@ -462,20 +450,20 @@ static void free_vfsmnt(struct vfsmount *mnt)
462 * @dir. If @dir is set return the first mount else return the last mount. 450 * @dir. If @dir is set return the first mount else return the last mount.
463 * vfsmount_lock must be held for read or write. 451 * vfsmount_lock must be held for read or write.
464 */ 452 */
465struct vfsmount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry, 453struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry,
466 int dir) 454 int dir)
467{ 455{
468 struct list_head *head = mount_hashtable + hash(mnt, dentry); 456 struct list_head *head = mount_hashtable + hash(mnt, dentry);
469 struct list_head *tmp = head; 457 struct list_head *tmp = head;
470 struct vfsmount *p, *found = NULL; 458 struct mount *p, *found = NULL;
471 459
472 for (;;) { 460 for (;;) {
473 tmp = dir ? tmp->next : tmp->prev; 461 tmp = dir ? tmp->next : tmp->prev;
474 p = NULL; 462 p = NULL;
475 if (tmp == head) 463 if (tmp == head)
476 break; 464 break;
477 p = list_entry(tmp, struct vfsmount, mnt_hash); 465 p = list_entry(tmp, struct mount, mnt_hash);
478 if (p->mnt_parent == mnt && p->mnt_mountpoint == dentry) { 466 if (&p->mnt_parent->mnt == mnt && p->mnt_mountpoint == dentry) {
479 found = p; 467 found = p;
480 break; 468 break;
481 } 469 }
@@ -489,16 +477,21 @@ struct vfsmount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry,
489 */ 477 */
490struct vfsmount *lookup_mnt(struct path *path) 478struct vfsmount *lookup_mnt(struct path *path)
491{ 479{
492 struct vfsmount *child_mnt; 480 struct mount *child_mnt;
493 481
494 br_read_lock(vfsmount_lock); 482 br_read_lock(vfsmount_lock);
495 if ((child_mnt = __lookup_mnt(path->mnt, path->dentry, 1))) 483 child_mnt = __lookup_mnt(path->mnt, path->dentry, 1);
496 mntget(child_mnt); 484 if (child_mnt) {
497 br_read_unlock(vfsmount_lock); 485 mnt_add_count(child_mnt, 1);
498 return child_mnt; 486 br_read_unlock(vfsmount_lock);
487 return &child_mnt->mnt;
488 } else {
489 br_read_unlock(vfsmount_lock);
490 return NULL;
491 }
499} 492}
500 493
501static inline int check_mnt(struct vfsmount *mnt) 494static inline int check_mnt(struct mount *mnt)
502{ 495{
503 return mnt->mnt_ns == current->nsproxy->mnt_ns; 496 return mnt->mnt_ns == current->nsproxy->mnt_ns;
504} 497}
@@ -534,7 +527,7 @@ static void dentry_reset_mounted(struct dentry *dentry)
534 unsigned u; 527 unsigned u;
535 528
536 for (u = 0; u < HASH_SIZE; u++) { 529 for (u = 0; u < HASH_SIZE; u++) {
537 struct vfsmount *p; 530 struct mount *p;
538 531
539 list_for_each_entry(p, &mount_hashtable[u], mnt_hash) { 532 list_for_each_entry(p, &mount_hashtable[u], mnt_hash) {
540 if (p->mnt_mountpoint == dentry) 533 if (p->mnt_mountpoint == dentry)
@@ -549,12 +542,12 @@ static void dentry_reset_mounted(struct dentry *dentry)
549/* 542/*
550 * vfsmount lock must be held for write 543 * vfsmount lock must be held for write
551 */ 544 */
552static void detach_mnt(struct vfsmount *mnt, struct path *old_path) 545static void detach_mnt(struct mount *mnt, struct path *old_path)
553{ 546{
554 old_path->dentry = mnt->mnt_mountpoint; 547 old_path->dentry = mnt->mnt_mountpoint;
555 old_path->mnt = mnt->mnt_parent; 548 old_path->mnt = &mnt->mnt_parent->mnt;
556 mnt->mnt_parent = mnt; 549 mnt->mnt_parent = mnt;
557 mnt->mnt_mountpoint = mnt->mnt_root; 550 mnt->mnt_mountpoint = mnt->mnt.mnt_root;
558 list_del_init(&mnt->mnt_child); 551 list_del_init(&mnt->mnt_child);
559 list_del_init(&mnt->mnt_hash); 552 list_del_init(&mnt->mnt_hash);
560 dentry_reset_mounted(old_path->dentry); 553 dentry_reset_mounted(old_path->dentry);
@@ -563,11 +556,12 @@ static void detach_mnt(struct vfsmount *mnt, struct path *old_path)
563/* 556/*
564 * vfsmount lock must be held for write 557 * vfsmount lock must be held for write
565 */ 558 */
566void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry, 559void mnt_set_mountpoint(struct mount *mnt, struct dentry *dentry,
567 struct vfsmount *child_mnt) 560 struct mount *child_mnt)
568{ 561{
569 child_mnt->mnt_parent = mntget(mnt); 562 mnt_add_count(mnt, 1); /* essentially, that's mntget */
570 child_mnt->mnt_mountpoint = dget(dentry); 563 child_mnt->mnt_mountpoint = dget(dentry);
564 child_mnt->mnt_parent = mnt;
571 spin_lock(&dentry->d_lock); 565 spin_lock(&dentry->d_lock);
572 dentry->d_flags |= DCACHE_MOUNTED; 566 dentry->d_flags |= DCACHE_MOUNTED;
573 spin_unlock(&dentry->d_lock); 567 spin_unlock(&dentry->d_lock);
@@ -576,15 +570,15 @@ void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry,
576/* 570/*
577 * vfsmount lock must be held for write 571 * vfsmount lock must be held for write
578 */ 572 */
579static void attach_mnt(struct vfsmount *mnt, struct path *path) 573static void attach_mnt(struct mount *mnt, struct path *path)
580{ 574{
581 mnt_set_mountpoint(path->mnt, path->dentry, mnt); 575 mnt_set_mountpoint(real_mount(path->mnt), path->dentry, mnt);
582 list_add_tail(&mnt->mnt_hash, mount_hashtable + 576 list_add_tail(&mnt->mnt_hash, mount_hashtable +
583 hash(path->mnt, path->dentry)); 577 hash(path->mnt, path->dentry));
584 list_add_tail(&mnt->mnt_child, &path->mnt->mnt_mounts); 578 list_add_tail(&mnt->mnt_child, &real_mount(path->mnt)->mnt_mounts);
585} 579}
586 580
587static inline void __mnt_make_longterm(struct vfsmount *mnt) 581static inline void __mnt_make_longterm(struct mount *mnt)
588{ 582{
589#ifdef CONFIG_SMP 583#ifdef CONFIG_SMP
590 atomic_inc(&mnt->mnt_longterm); 584 atomic_inc(&mnt->mnt_longterm);
@@ -592,7 +586,7 @@ static inline void __mnt_make_longterm(struct vfsmount *mnt)
592} 586}
593 587
594/* needs vfsmount lock for write */ 588/* needs vfsmount lock for write */
595static inline void __mnt_make_shortterm(struct vfsmount *mnt) 589static inline void __mnt_make_shortterm(struct mount *mnt)
596{ 590{
597#ifdef CONFIG_SMP 591#ifdef CONFIG_SMP
598 atomic_dec(&mnt->mnt_longterm); 592 atomic_dec(&mnt->mnt_longterm);
@@ -602,10 +596,10 @@ static inline void __mnt_make_shortterm(struct vfsmount *mnt)
602/* 596/*
603 * vfsmount lock must be held for write 597 * vfsmount lock must be held for write
604 */ 598 */
605static void commit_tree(struct vfsmount *mnt) 599static void commit_tree(struct mount *mnt)
606{ 600{
607 struct vfsmount *parent = mnt->mnt_parent; 601 struct mount *parent = mnt->mnt_parent;
608 struct vfsmount *m; 602 struct mount *m;
609 LIST_HEAD(head); 603 LIST_HEAD(head);
610 struct mnt_namespace *n = parent->mnt_ns; 604 struct mnt_namespace *n = parent->mnt_ns;
611 605
@@ -620,12 +614,12 @@ static void commit_tree(struct vfsmount *mnt)
620 list_splice(&head, n->list.prev); 614 list_splice(&head, n->list.prev);
621 615
622 list_add_tail(&mnt->mnt_hash, mount_hashtable + 616 list_add_tail(&mnt->mnt_hash, mount_hashtable +
623 hash(parent, mnt->mnt_mountpoint)); 617 hash(&parent->mnt, mnt->mnt_mountpoint));
624 list_add_tail(&mnt->mnt_child, &parent->mnt_mounts); 618 list_add_tail(&mnt->mnt_child, &parent->mnt_mounts);
625 touch_mnt_namespace(n); 619 touch_mnt_namespace(n);
626} 620}
627 621
628static struct vfsmount *next_mnt(struct vfsmount *p, struct vfsmount *root) 622static struct mount *next_mnt(struct mount *p, struct mount *root)
629{ 623{
630 struct list_head *next = p->mnt_mounts.next; 624 struct list_head *next = p->mnt_mounts.next;
631 if (next == &p->mnt_mounts) { 625 if (next == &p->mnt_mounts) {
@@ -638,14 +632,14 @@ static struct vfsmount *next_mnt(struct vfsmount *p, struct vfsmount *root)
638 p = p->mnt_parent; 632 p = p->mnt_parent;
639 } 633 }
640 } 634 }
641 return list_entry(next, struct vfsmount, mnt_child); 635 return list_entry(next, struct mount, mnt_child);
642} 636}
643 637
644static struct vfsmount *skip_mnt_tree(struct vfsmount *p) 638static struct mount *skip_mnt_tree(struct mount *p)
645{ 639{
646 struct list_head *prev = p->mnt_mounts.prev; 640 struct list_head *prev = p->mnt_mounts.prev;
647 while (prev != &p->mnt_mounts) { 641 while (prev != &p->mnt_mounts) {
648 p = list_entry(prev, struct vfsmount, mnt_child); 642 p = list_entry(prev, struct mount, mnt_child);
649 prev = p->mnt_mounts.prev; 643 prev = p->mnt_mounts.prev;
650 } 644 }
651 return p; 645 return p;
@@ -654,7 +648,7 @@ static struct vfsmount *skip_mnt_tree(struct vfsmount *p)
654struct vfsmount * 648struct vfsmount *
655vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data) 649vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data)
656{ 650{
657 struct vfsmount *mnt; 651 struct mount *mnt;
658 struct dentry *root; 652 struct dentry *root;
659 653
660 if (!type) 654 if (!type)
@@ -665,7 +659,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
665 return ERR_PTR(-ENOMEM); 659 return ERR_PTR(-ENOMEM);
666 660
667 if (flags & MS_KERNMOUNT) 661 if (flags & MS_KERNMOUNT)
668 mnt->mnt_flags = MNT_INTERNAL; 662 mnt->mnt.mnt_flags = MNT_INTERNAL;
669 663
670 root = mount_fs(type, flags, name, data); 664 root = mount_fs(type, flags, name, data);
671 if (IS_ERR(root)) { 665 if (IS_ERR(root)) {
@@ -673,19 +667,19 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
673 return ERR_CAST(root); 667 return ERR_CAST(root);
674 } 668 }
675 669
676 mnt->mnt_root = root; 670 mnt->mnt.mnt_root = root;
677 mnt->mnt_sb = root->d_sb; 671 mnt->mnt.mnt_sb = root->d_sb;
678 mnt->mnt_mountpoint = mnt->mnt_root; 672 mnt->mnt_mountpoint = mnt->mnt.mnt_root;
679 mnt->mnt_parent = mnt; 673 mnt->mnt_parent = mnt;
680 return mnt; 674 return &mnt->mnt;
681} 675}
682EXPORT_SYMBOL_GPL(vfs_kern_mount); 676EXPORT_SYMBOL_GPL(vfs_kern_mount);
683 677
684static struct vfsmount *clone_mnt(struct vfsmount *old, struct dentry *root, 678static struct mount *clone_mnt(struct mount *old, struct dentry *root,
685 int flag) 679 int flag)
686{ 680{
687 struct super_block *sb = old->mnt_sb; 681 struct super_block *sb = old->mnt.mnt_sb;
688 struct vfsmount *mnt = alloc_vfsmnt(old->mnt_devname); 682 struct mount *mnt = alloc_vfsmnt(old->mnt_devname);
689 683
690 if (mnt) { 684 if (mnt) {
691 if (flag & (CL_SLAVE | CL_PRIVATE)) 685 if (flag & (CL_SLAVE | CL_PRIVATE))
@@ -699,11 +693,11 @@ static struct vfsmount *clone_mnt(struct vfsmount *old, struct dentry *root,
699 goto out_free; 693 goto out_free;
700 } 694 }
701 695
702 mnt->mnt_flags = old->mnt_flags & ~MNT_WRITE_HOLD; 696 mnt->mnt.mnt_flags = old->mnt.mnt_flags & ~MNT_WRITE_HOLD;
703 atomic_inc(&sb->s_active); 697 atomic_inc(&sb->s_active);
704 mnt->mnt_sb = sb; 698 mnt->mnt.mnt_sb = sb;
705 mnt->mnt_root = dget(root); 699 mnt->mnt.mnt_root = dget(root);
706 mnt->mnt_mountpoint = mnt->mnt_root; 700 mnt->mnt_mountpoint = mnt->mnt.mnt_root;
707 mnt->mnt_parent = mnt; 701 mnt->mnt_parent = mnt;
708 702
709 if (flag & CL_SLAVE) { 703 if (flag & CL_SLAVE) {
@@ -734,9 +728,10 @@ static struct vfsmount *clone_mnt(struct vfsmount *old, struct dentry *root,
734 return NULL; 728 return NULL;
735} 729}
736 730
737static inline void mntfree(struct vfsmount *mnt) 731static inline void mntfree(struct mount *mnt)
738{ 732{
739 struct super_block *sb = mnt->mnt_sb; 733 struct vfsmount *m = &mnt->mnt;
734 struct super_block *sb = m->mnt_sb;
740 735
741 /* 736 /*
742 * This probably indicates that somebody messed 737 * This probably indicates that somebody messed
@@ -749,13 +744,13 @@ static inline void mntfree(struct vfsmount *mnt)
749 * so mnt_get_writers() below is safe. 744 * so mnt_get_writers() below is safe.
750 */ 745 */
751 WARN_ON(mnt_get_writers(mnt)); 746 WARN_ON(mnt_get_writers(mnt));
752 fsnotify_vfsmount_delete(mnt); 747 fsnotify_vfsmount_delete(m);
753 dput(mnt->mnt_root); 748 dput(m->mnt_root);
754 free_vfsmnt(mnt); 749 free_vfsmnt(mnt);
755 deactivate_super(sb); 750 deactivate_super(sb);
756} 751}
757 752
758static void mntput_no_expire(struct vfsmount *mnt) 753static void mntput_no_expire(struct mount *mnt)
759{ 754{
760put_again: 755put_again:
761#ifdef CONFIG_SMP 756#ifdef CONFIG_SMP
@@ -783,7 +778,7 @@ put_again:
783 mnt_add_count(mnt, mnt->mnt_pinned + 1); 778 mnt_add_count(mnt, mnt->mnt_pinned + 1);
784 mnt->mnt_pinned = 0; 779 mnt->mnt_pinned = 0;
785 br_write_unlock(vfsmount_lock); 780 br_write_unlock(vfsmount_lock);
786 acct_auto_close_mnt(mnt); 781 acct_auto_close_mnt(&mnt->mnt);
787 goto put_again; 782 goto put_again;
788 } 783 }
789 br_write_unlock(vfsmount_lock); 784 br_write_unlock(vfsmount_lock);
@@ -793,10 +788,11 @@ put_again:
793void mntput(struct vfsmount *mnt) 788void mntput(struct vfsmount *mnt)
794{ 789{
795 if (mnt) { 790 if (mnt) {
791 struct mount *m = real_mount(mnt);
796 /* avoid cacheline pingpong, hope gcc doesn't get "smart" */ 792 /* avoid cacheline pingpong, hope gcc doesn't get "smart" */
797 if (unlikely(mnt->mnt_expiry_mark)) 793 if (unlikely(m->mnt_expiry_mark))
798 mnt->mnt_expiry_mark = 0; 794 m->mnt_expiry_mark = 0;
799 mntput_no_expire(mnt); 795 mntput_no_expire(m);
800 } 796 }
801} 797}
802EXPORT_SYMBOL(mntput); 798EXPORT_SYMBOL(mntput);
@@ -804,7 +800,7 @@ EXPORT_SYMBOL(mntput);
804struct vfsmount *mntget(struct vfsmount *mnt) 800struct vfsmount *mntget(struct vfsmount *mnt)
805{ 801{
806 if (mnt) 802 if (mnt)
807 mnt_add_count(mnt, 1); 803 mnt_add_count(real_mount(mnt), 1);
808 return mnt; 804 return mnt;
809} 805}
810EXPORT_SYMBOL(mntget); 806EXPORT_SYMBOL(mntget);
@@ -812,13 +808,14 @@ EXPORT_SYMBOL(mntget);
812void mnt_pin(struct vfsmount *mnt) 808void mnt_pin(struct vfsmount *mnt)
813{ 809{
814 br_write_lock(vfsmount_lock); 810 br_write_lock(vfsmount_lock);
815 mnt->mnt_pinned++; 811 real_mount(mnt)->mnt_pinned++;
816 br_write_unlock(vfsmount_lock); 812 br_write_unlock(vfsmount_lock);
817} 813}
818EXPORT_SYMBOL(mnt_pin); 814EXPORT_SYMBOL(mnt_pin);
819 815
820void mnt_unpin(struct vfsmount *mnt) 816void mnt_unpin(struct vfsmount *m)
821{ 817{
818 struct mount *mnt = real_mount(m);
822 br_write_lock(vfsmount_lock); 819 br_write_lock(vfsmount_lock);
823 if (mnt->mnt_pinned) { 820 if (mnt->mnt_pinned) {
824 mnt_add_count(mnt, 1); 821 mnt_add_count(mnt, 1);
@@ -888,10 +885,10 @@ void replace_mount_options(struct super_block *sb, char *options)
888EXPORT_SYMBOL(replace_mount_options); 885EXPORT_SYMBOL(replace_mount_options);
889 886
890#ifdef CONFIG_PROC_FS 887#ifdef CONFIG_PROC_FS
891/* iterator */ 888/* iterator; we want it to have access to namespace_sem, thus here... */
892static void *m_start(struct seq_file *m, loff_t *pos) 889static void *m_start(struct seq_file *m, loff_t *pos)
893{ 890{
894 struct proc_mounts *p = m->private; 891 struct proc_mounts *p = container_of(m, struct proc_mounts, m);
895 892
896 down_read(&namespace_sem); 893 down_read(&namespace_sem);
897 return seq_list_start(&p->ns->list, *pos); 894 return seq_list_start(&p->ns->list, *pos);
@@ -899,7 +896,7 @@ static void *m_start(struct seq_file *m, loff_t *pos)
899 896
900static void *m_next(struct seq_file *m, void *v, loff_t *pos) 897static void *m_next(struct seq_file *m, void *v, loff_t *pos)
901{ 898{
902 struct proc_mounts *p = m->private; 899 struct proc_mounts *p = container_of(m, struct proc_mounts, m);
903 900
904 return seq_list_next(v, &p->ns->list, pos); 901 return seq_list_next(v, &p->ns->list, pos);
905} 902}
@@ -909,219 +906,18 @@ static void m_stop(struct seq_file *m, void *v)
909 up_read(&namespace_sem); 906 up_read(&namespace_sem);
910} 907}
911 908
912int mnt_had_events(struct proc_mounts *p) 909static int m_show(struct seq_file *m, void *v)
913{
914 struct mnt_namespace *ns = p->ns;
915 int res = 0;
916
917 br_read_lock(vfsmount_lock);
918 if (p->m.poll_event != ns->event) {
919 p->m.poll_event = ns->event;
920 res = 1;
921 }
922 br_read_unlock(vfsmount_lock);
923
924 return res;
925}
926
927struct proc_fs_info {
928 int flag;
929 const char *str;
930};
931
932static int show_sb_opts(struct seq_file *m, struct super_block *sb)
933{
934 static const struct proc_fs_info fs_info[] = {
935 { MS_SYNCHRONOUS, ",sync" },
936 { MS_DIRSYNC, ",dirsync" },
937 { MS_MANDLOCK, ",mand" },
938 { 0, NULL }
939 };
940 const struct proc_fs_info *fs_infop;
941
942 for (fs_infop = fs_info; fs_infop->flag; fs_infop++) {
943 if (sb->s_flags & fs_infop->flag)
944 seq_puts(m, fs_infop->str);
945 }
946
947 return security_sb_show_options(m, sb);
948}
949
950static void show_mnt_opts(struct seq_file *m, struct vfsmount *mnt)
951{ 910{
952 static const struct proc_fs_info mnt_info[] = { 911 struct proc_mounts *p = container_of(m, struct proc_mounts, m);
953 { MNT_NOSUID, ",nosuid" }, 912 struct mount *r = list_entry(v, struct mount, mnt_list);
954 { MNT_NODEV, ",nodev" }, 913 return p->show(m, &r->mnt);
955 { MNT_NOEXEC, ",noexec" },
956 { MNT_NOATIME, ",noatime" },
957 { MNT_NODIRATIME, ",nodiratime" },
958 { MNT_RELATIME, ",relatime" },
959 { 0, NULL }
960 };
961 const struct proc_fs_info *fs_infop;
962
963 for (fs_infop = mnt_info; fs_infop->flag; fs_infop++) {
964 if (mnt->mnt_flags & fs_infop->flag)
965 seq_puts(m, fs_infop->str);
966 }
967}
968
969static void show_type(struct seq_file *m, struct super_block *sb)
970{
971 mangle(m, sb->s_type->name);
972 if (sb->s_subtype && sb->s_subtype[0]) {
973 seq_putc(m, '.');
974 mangle(m, sb->s_subtype);
975 }
976}
977
978static int show_vfsmnt(struct seq_file *m, void *v)
979{
980 struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list);
981 int err = 0;
982 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
983
984 if (mnt->mnt_sb->s_op->show_devname) {
985 err = mnt->mnt_sb->s_op->show_devname(m, mnt);
986 if (err)
987 goto out;
988 } else {
989 mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
990 }
991 seq_putc(m, ' ');
992 seq_path(m, &mnt_path, " \t\n\\");
993 seq_putc(m, ' ');
994 show_type(m, mnt->mnt_sb);
995 seq_puts(m, __mnt_is_readonly(mnt) ? " ro" : " rw");
996 err = show_sb_opts(m, mnt->mnt_sb);
997 if (err)
998 goto out;
999 show_mnt_opts(m, mnt);
1000 if (mnt->mnt_sb->s_op->show_options)
1001 err = mnt->mnt_sb->s_op->show_options(m, mnt);
1002 seq_puts(m, " 0 0\n");
1003out:
1004 return err;
1005} 914}
1006 915
1007const struct seq_operations mounts_op = { 916const struct seq_operations mounts_op = {
1008 .start = m_start, 917 .start = m_start,
1009 .next = m_next, 918 .next = m_next,
1010 .stop = m_stop, 919 .stop = m_stop,
1011 .show = show_vfsmnt 920 .show = m_show,
1012};
1013
1014static int show_mountinfo(struct seq_file *m, void *v)
1015{
1016 struct proc_mounts *p = m->private;
1017 struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list);
1018 struct super_block *sb = mnt->mnt_sb;
1019 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
1020 struct path root = p->root;
1021 int err = 0;
1022
1023 seq_printf(m, "%i %i %u:%u ", mnt->mnt_id, mnt->mnt_parent->mnt_id,
1024 MAJOR(sb->s_dev), MINOR(sb->s_dev));
1025 if (sb->s_op->show_path)
1026 err = sb->s_op->show_path(m, mnt);
1027 else
1028 seq_dentry(m, mnt->mnt_root, " \t\n\\");
1029 if (err)
1030 goto out;
1031 seq_putc(m, ' ');
1032
1033 /* mountpoints outside of chroot jail will give SEQ_SKIP on this */
1034 err = seq_path_root(m, &mnt_path, &root, " \t\n\\");
1035 if (err)
1036 goto out;
1037
1038 seq_puts(m, mnt->mnt_flags & MNT_READONLY ? " ro" : " rw");
1039 show_mnt_opts(m, mnt);
1040
1041 /* Tagged fields ("foo:X" or "bar") */
1042 if (IS_MNT_SHARED(mnt))
1043 seq_printf(m, " shared:%i", mnt->mnt_group_id);
1044 if (IS_MNT_SLAVE(mnt)) {
1045 int master = mnt->mnt_master->mnt_group_id;
1046 int dom = get_dominating_id(mnt, &p->root);
1047 seq_printf(m, " master:%i", master);
1048 if (dom && dom != master)
1049 seq_printf(m, " propagate_from:%i", dom);
1050 }
1051 if (IS_MNT_UNBINDABLE(mnt))
1052 seq_puts(m, " unbindable");
1053
1054 /* Filesystem specific data */
1055 seq_puts(m, " - ");
1056 show_type(m, sb);
1057 seq_putc(m, ' ');
1058 if (sb->s_op->show_devname)
1059 err = sb->s_op->show_devname(m, mnt);
1060 else
1061 mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
1062 if (err)
1063 goto out;
1064 seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw");
1065 err = show_sb_opts(m, sb);
1066 if (err)
1067 goto out;
1068 if (sb->s_op->show_options)
1069 err = sb->s_op->show_options(m, mnt);
1070 seq_putc(m, '\n');
1071out:
1072 return err;
1073}
1074
1075const struct seq_operations mountinfo_op = {
1076 .start = m_start,
1077 .next = m_next,
1078 .stop = m_stop,
1079 .show = show_mountinfo,
1080};
1081
1082static int show_vfsstat(struct seq_file *m, void *v)
1083{
1084 struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list);
1085 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
1086 int err = 0;
1087
1088 /* device */
1089 if (mnt->mnt_sb->s_op->show_devname) {
1090 seq_puts(m, "device ");
1091 err = mnt->mnt_sb->s_op->show_devname(m, mnt);
1092 } else {
1093 if (mnt->mnt_devname) {
1094 seq_puts(m, "device ");
1095 mangle(m, mnt->mnt_devname);
1096 } else
1097 seq_puts(m, "no device");
1098 }
1099
1100 /* mount point */
1101 seq_puts(m, " mounted on ");
1102 seq_path(m, &mnt_path, " \t\n\\");
1103 seq_putc(m, ' ');
1104
1105 /* file system type */
1106 seq_puts(m, "with fstype ");
1107 show_type(m, mnt->mnt_sb);
1108
1109 /* optional statistics */
1110 if (mnt->mnt_sb->s_op->show_stats) {
1111 seq_putc(m, ' ');
1112 if (!err)
1113 err = mnt->mnt_sb->s_op->show_stats(m, mnt);
1114 }
1115
1116 seq_putc(m, '\n');
1117 return err;
1118}
1119
1120const struct seq_operations mountstats_op = {
1121 .start = m_start,
1122 .next = m_next,
1123 .stop = m_stop,
1124 .show = show_vfsstat,
1125}; 921};
1126#endif /* CONFIG_PROC_FS */ 922#endif /* CONFIG_PROC_FS */
1127 923
@@ -1133,11 +929,13 @@ const struct seq_operations mountstats_op = {
1133 * open files, pwds, chroots or sub mounts that are 929 * open files, pwds, chroots or sub mounts that are
1134 * busy. 930 * busy.
1135 */ 931 */
1136int may_umount_tree(struct vfsmount *mnt) 932int may_umount_tree(struct vfsmount *m)
1137{ 933{
934 struct mount *mnt = real_mount(m);
1138 int actual_refs = 0; 935 int actual_refs = 0;
1139 int minimum_refs = 0; 936 int minimum_refs = 0;
1140 struct vfsmount *p; 937 struct mount *p;
938 BUG_ON(!m);
1141 939
1142 /* write lock needed for mnt_get_count */ 940 /* write lock needed for mnt_get_count */
1143 br_write_lock(vfsmount_lock); 941 br_write_lock(vfsmount_lock);
@@ -1173,7 +971,7 @@ int may_umount(struct vfsmount *mnt)
1173 int ret = 1; 971 int ret = 1;
1174 down_read(&namespace_sem); 972 down_read(&namespace_sem);
1175 br_write_lock(vfsmount_lock); 973 br_write_lock(vfsmount_lock);
1176 if (propagate_mount_busy(mnt, 2)) 974 if (propagate_mount_busy(real_mount(mnt), 2))
1177 ret = 0; 975 ret = 0;
1178 br_write_unlock(vfsmount_lock); 976 br_write_unlock(vfsmount_lock);
1179 up_read(&namespace_sem); 977 up_read(&namespace_sem);
@@ -1184,25 +982,25 @@ EXPORT_SYMBOL(may_umount);
1184 982
1185void release_mounts(struct list_head *head) 983void release_mounts(struct list_head *head)
1186{ 984{
1187 struct vfsmount *mnt; 985 struct mount *mnt;
1188 while (!list_empty(head)) { 986 while (!list_empty(head)) {
1189 mnt = list_first_entry(head, struct vfsmount, mnt_hash); 987 mnt = list_first_entry(head, struct mount, mnt_hash);
1190 list_del_init(&mnt->mnt_hash); 988 list_del_init(&mnt->mnt_hash);
1191 if (mnt_has_parent(mnt)) { 989 if (mnt_has_parent(mnt)) {
1192 struct dentry *dentry; 990 struct dentry *dentry;
1193 struct vfsmount *m; 991 struct mount *m;
1194 992
1195 br_write_lock(vfsmount_lock); 993 br_write_lock(vfsmount_lock);
1196 dentry = mnt->mnt_mountpoint; 994 dentry = mnt->mnt_mountpoint;
1197 m = mnt->mnt_parent; 995 m = mnt->mnt_parent;
1198 mnt->mnt_mountpoint = mnt->mnt_root; 996 mnt->mnt_mountpoint = mnt->mnt.mnt_root;
1199 mnt->mnt_parent = mnt; 997 mnt->mnt_parent = mnt;
1200 m->mnt_ghosts--; 998 m->mnt_ghosts--;
1201 br_write_unlock(vfsmount_lock); 999 br_write_unlock(vfsmount_lock);
1202 dput(dentry); 1000 dput(dentry);
1203 mntput(m); 1001 mntput(&m->mnt);
1204 } 1002 }
1205 mntput(mnt); 1003 mntput(&mnt->mnt);
1206 } 1004 }
1207} 1005}
1208 1006
@@ -1210,10 +1008,10 @@ void release_mounts(struct list_head *head)
1210 * vfsmount lock must be held for write 1008 * vfsmount lock must be held for write
1211 * namespace_sem must be held for write 1009 * namespace_sem must be held for write
1212 */ 1010 */
1213void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill) 1011void umount_tree(struct mount *mnt, int propagate, struct list_head *kill)
1214{ 1012{
1215 LIST_HEAD(tmp_list); 1013 LIST_HEAD(tmp_list);
1216 struct vfsmount *p; 1014 struct mount *p;
1217 1015
1218 for (p = mnt; p; p = next_mnt(p, mnt)) 1016 for (p = mnt; p; p = next_mnt(p, mnt))
1219 list_move(&p->mnt_hash, &tmp_list); 1017 list_move(&p->mnt_hash, &tmp_list);
@@ -1237,15 +1035,15 @@ void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)
1237 list_splice(&tmp_list, kill); 1035 list_splice(&tmp_list, kill);
1238} 1036}
1239 1037
1240static void shrink_submounts(struct vfsmount *mnt, struct list_head *umounts); 1038static void shrink_submounts(struct mount *mnt, struct list_head *umounts);
1241 1039
1242static int do_umount(struct vfsmount *mnt, int flags) 1040static int do_umount(struct mount *mnt, int flags)
1243{ 1041{
1244 struct super_block *sb = mnt->mnt_sb; 1042 struct super_block *sb = mnt->mnt.mnt_sb;
1245 int retval; 1043 int retval;
1246 LIST_HEAD(umount_list); 1044 LIST_HEAD(umount_list);
1247 1045
1248 retval = security_sb_umount(mnt, flags); 1046 retval = security_sb_umount(&mnt->mnt, flags);
1249 if (retval) 1047 if (retval)
1250 return retval; 1048 return retval;
1251 1049
@@ -1256,7 +1054,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
1256 * (2) the usage count == 1 [parent vfsmount] + 1 [sys_umount] 1054 * (2) the usage count == 1 [parent vfsmount] + 1 [sys_umount]
1257 */ 1055 */
1258 if (flags & MNT_EXPIRE) { 1056 if (flags & MNT_EXPIRE) {
1259 if (mnt == current->fs->root.mnt || 1057 if (&mnt->mnt == current->fs->root.mnt ||
1260 flags & (MNT_FORCE | MNT_DETACH)) 1058 flags & (MNT_FORCE | MNT_DETACH))
1261 return -EINVAL; 1059 return -EINVAL;
1262 1060
@@ -1298,7 +1096,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
1298 * /reboot - static binary that would close all descriptors and 1096 * /reboot - static binary that would close all descriptors and
1299 * call reboot(9). Then init(8) could umount root and exec /reboot. 1097 * call reboot(9). Then init(8) could umount root and exec /reboot.
1300 */ 1098 */
1301 if (mnt == current->fs->root.mnt && !(flags & MNT_DETACH)) { 1099 if (&mnt->mnt == current->fs->root.mnt && !(flags & MNT_DETACH)) {
1302 /* 1100 /*
1303 * Special case for "unmounting" root ... 1101 * Special case for "unmounting" root ...
1304 * we just try to remount it readonly. 1102 * we just try to remount it readonly.
@@ -1340,6 +1138,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
1340SYSCALL_DEFINE2(umount, char __user *, name, int, flags) 1138SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
1341{ 1139{
1342 struct path path; 1140 struct path path;
1141 struct mount *mnt;
1343 int retval; 1142 int retval;
1344 int lookup_flags = 0; 1143 int lookup_flags = 0;
1345 1144
@@ -1352,21 +1151,22 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
1352 retval = user_path_at(AT_FDCWD, name, lookup_flags, &path); 1151 retval = user_path_at(AT_FDCWD, name, lookup_flags, &path);
1353 if (retval) 1152 if (retval)
1354 goto out; 1153 goto out;
1154 mnt = real_mount(path.mnt);
1355 retval = -EINVAL; 1155 retval = -EINVAL;
1356 if (path.dentry != path.mnt->mnt_root) 1156 if (path.dentry != path.mnt->mnt_root)
1357 goto dput_and_out; 1157 goto dput_and_out;
1358 if (!check_mnt(path.mnt)) 1158 if (!check_mnt(mnt))
1359 goto dput_and_out; 1159 goto dput_and_out;
1360 1160
1361 retval = -EPERM; 1161 retval = -EPERM;
1362 if (!capable(CAP_SYS_ADMIN)) 1162 if (!capable(CAP_SYS_ADMIN))
1363 goto dput_and_out; 1163 goto dput_and_out;
1364 1164
1365 retval = do_umount(path.mnt, flags); 1165 retval = do_umount(mnt, flags);
1366dput_and_out: 1166dput_and_out:
1367 /* we mustn't call path_put() as that would clear mnt_expiry_mark */ 1167 /* we mustn't call path_put() as that would clear mnt_expiry_mark */
1368 dput(path.dentry); 1168 dput(path.dentry);
1369 mntput_no_expire(path.mnt); 1169 mntput_no_expire(mnt);
1370out: 1170out:
1371 return retval; 1171 return retval;
1372} 1172}
@@ -1401,10 +1201,10 @@ static int mount_is_safe(struct path *path)
1401#endif 1201#endif
1402} 1202}
1403 1203
1404struct vfsmount *copy_tree(struct vfsmount *mnt, struct dentry *dentry, 1204struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
1405 int flag) 1205 int flag)
1406{ 1206{
1407 struct vfsmount *res, *p, *q, *r, *s; 1207 struct mount *res, *p, *q, *r;
1408 struct path path; 1208 struct path path;
1409 1209
1410 if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(mnt)) 1210 if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(mnt))
@@ -1417,6 +1217,7 @@ struct vfsmount *copy_tree(struct vfsmount *mnt, struct dentry *dentry,
1417 1217
1418 p = mnt; 1218 p = mnt;
1419 list_for_each_entry(r, &mnt->mnt_mounts, mnt_child) { 1219 list_for_each_entry(r, &mnt->mnt_mounts, mnt_child) {
1220 struct mount *s;
1420 if (!is_subdir(r->mnt_mountpoint, dentry)) 1221 if (!is_subdir(r->mnt_mountpoint, dentry))
1421 continue; 1222 continue;
1422 1223
@@ -1430,9 +1231,9 @@ struct vfsmount *copy_tree(struct vfsmount *mnt, struct dentry *dentry,
1430 q = q->mnt_parent; 1231 q = q->mnt_parent;
1431 } 1232 }
1432 p = s; 1233 p = s;
1433 path.mnt = q; 1234 path.mnt = &q->mnt;
1434 path.dentry = p->mnt_mountpoint; 1235 path.dentry = p->mnt_mountpoint;
1435 q = clone_mnt(p, p->mnt_root, flag); 1236 q = clone_mnt(p, p->mnt.mnt_root, flag);
1436 if (!q) 1237 if (!q)
1437 goto Enomem; 1238 goto Enomem;
1438 br_write_lock(vfsmount_lock); 1239 br_write_lock(vfsmount_lock);
@@ -1455,11 +1256,12 @@ Enomem:
1455 1256
1456struct vfsmount *collect_mounts(struct path *path) 1257struct vfsmount *collect_mounts(struct path *path)
1457{ 1258{
1458 struct vfsmount *tree; 1259 struct mount *tree;
1459 down_write(&namespace_sem); 1260 down_write(&namespace_sem);
1460 tree = copy_tree(path->mnt, path->dentry, CL_COPY_ALL | CL_PRIVATE); 1261 tree = copy_tree(real_mount(path->mnt), path->dentry,
1262 CL_COPY_ALL | CL_PRIVATE);
1461 up_write(&namespace_sem); 1263 up_write(&namespace_sem);
1462 return tree; 1264 return tree ? &tree->mnt : NULL;
1463} 1265}
1464 1266
1465void drop_collected_mounts(struct vfsmount *mnt) 1267void drop_collected_mounts(struct vfsmount *mnt)
@@ -1467,7 +1269,7 @@ void drop_collected_mounts(struct vfsmount *mnt)
1467 LIST_HEAD(umount_list); 1269 LIST_HEAD(umount_list);
1468 down_write(&namespace_sem); 1270 down_write(&namespace_sem);
1469 br_write_lock(vfsmount_lock); 1271 br_write_lock(vfsmount_lock);
1470 umount_tree(mnt, 0, &umount_list); 1272 umount_tree(real_mount(mnt), 0, &umount_list);
1471 br_write_unlock(vfsmount_lock); 1273 br_write_unlock(vfsmount_lock);
1472 up_write(&namespace_sem); 1274 up_write(&namespace_sem);
1473 release_mounts(&umount_list); 1275 release_mounts(&umount_list);
@@ -1476,21 +1278,21 @@ void drop_collected_mounts(struct vfsmount *mnt)
1476int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg, 1278int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
1477 struct vfsmount *root) 1279 struct vfsmount *root)
1478{ 1280{
1479 struct vfsmount *mnt; 1281 struct mount *mnt;
1480 int res = f(root, arg); 1282 int res = f(root, arg);
1481 if (res) 1283 if (res)
1482 return res; 1284 return res;
1483 list_for_each_entry(mnt, &root->mnt_list, mnt_list) { 1285 list_for_each_entry(mnt, &real_mount(root)->mnt_list, mnt_list) {
1484 res = f(mnt, arg); 1286 res = f(&mnt->mnt, arg);
1485 if (res) 1287 if (res)
1486 return res; 1288 return res;
1487 } 1289 }
1488 return 0; 1290 return 0;
1489} 1291}
1490 1292
1491static void cleanup_group_ids(struct vfsmount *mnt, struct vfsmount *end) 1293static void cleanup_group_ids(struct mount *mnt, struct mount *end)
1492{ 1294{
1493 struct vfsmount *p; 1295 struct mount *p;
1494 1296
1495 for (p = mnt; p != end; p = next_mnt(p, mnt)) { 1297 for (p = mnt; p != end; p = next_mnt(p, mnt)) {
1496 if (p->mnt_group_id && !IS_MNT_SHARED(p)) 1298 if (p->mnt_group_id && !IS_MNT_SHARED(p))
@@ -1498,9 +1300,9 @@ static void cleanup_group_ids(struct vfsmount *mnt, struct vfsmount *end)
1498 } 1300 }
1499} 1301}
1500 1302
1501static int invent_group_ids(struct vfsmount *mnt, bool recurse) 1303static int invent_group_ids(struct mount *mnt, bool recurse)
1502{ 1304{
1503 struct vfsmount *p; 1305 struct mount *p;
1504 1306
1505 for (p = mnt; p; p = recurse ? next_mnt(p, mnt) : NULL) { 1307 for (p = mnt; p; p = recurse ? next_mnt(p, mnt) : NULL) {
1506 if (!p->mnt_group_id && !IS_MNT_SHARED(p)) { 1308 if (!p->mnt_group_id && !IS_MNT_SHARED(p)) {
@@ -1578,13 +1380,13 @@ static int invent_group_ids(struct vfsmount *mnt, bool recurse)
1578 * Must be called without spinlocks held, since this function can sleep 1380 * Must be called without spinlocks held, since this function can sleep
1579 * in allocations. 1381 * in allocations.
1580 */ 1382 */
1581static int attach_recursive_mnt(struct vfsmount *source_mnt, 1383static int attach_recursive_mnt(struct mount *source_mnt,
1582 struct path *path, struct path *parent_path) 1384 struct path *path, struct path *parent_path)
1583{ 1385{
1584 LIST_HEAD(tree_list); 1386 LIST_HEAD(tree_list);
1585 struct vfsmount *dest_mnt = path->mnt; 1387 struct mount *dest_mnt = real_mount(path->mnt);
1586 struct dentry *dest_dentry = path->dentry; 1388 struct dentry *dest_dentry = path->dentry;
1587 struct vfsmount *child, *p; 1389 struct mount *child, *p;
1588 int err; 1390 int err;
1589 1391
1590 if (IS_MNT_SHARED(dest_mnt)) { 1392 if (IS_MNT_SHARED(dest_mnt)) {
@@ -1605,7 +1407,7 @@ static int attach_recursive_mnt(struct vfsmount *source_mnt,
1605 if (parent_path) { 1407 if (parent_path) {
1606 detach_mnt(source_mnt, parent_path); 1408 detach_mnt(source_mnt, parent_path);
1607 attach_mnt(source_mnt, path); 1409 attach_mnt(source_mnt, path);
1608 touch_mnt_namespace(parent_path->mnt->mnt_ns); 1410 touch_mnt_namespace(source_mnt->mnt_ns);
1609 } else { 1411 } else {
1610 mnt_set_mountpoint(dest_mnt, dest_dentry, source_mnt); 1412 mnt_set_mountpoint(dest_mnt, dest_dentry, source_mnt);
1611 commit_tree(source_mnt); 1413 commit_tree(source_mnt);
@@ -1653,13 +1455,13 @@ static void unlock_mount(struct path *path)
1653 mutex_unlock(&path->dentry->d_inode->i_mutex); 1455 mutex_unlock(&path->dentry->d_inode->i_mutex);
1654} 1456}
1655 1457
1656static int graft_tree(struct vfsmount *mnt, struct path *path) 1458static int graft_tree(struct mount *mnt, struct path *path)
1657{ 1459{
1658 if (mnt->mnt_sb->s_flags & MS_NOUSER) 1460 if (mnt->mnt.mnt_sb->s_flags & MS_NOUSER)
1659 return -EINVAL; 1461 return -EINVAL;
1660 1462
1661 if (S_ISDIR(path->dentry->d_inode->i_mode) != 1463 if (S_ISDIR(path->dentry->d_inode->i_mode) !=
1662 S_ISDIR(mnt->mnt_root->d_inode->i_mode)) 1464 S_ISDIR(mnt->mnt.mnt_root->d_inode->i_mode))
1663 return -ENOTDIR; 1465 return -ENOTDIR;
1664 1466
1665 if (d_unlinked(path->dentry)) 1467 if (d_unlinked(path->dentry))
@@ -1690,7 +1492,8 @@ static int flags_to_propagation_type(int flags)
1690 */ 1492 */
1691static int do_change_type(struct path *path, int flag) 1493static int do_change_type(struct path *path, int flag)
1692{ 1494{
1693 struct vfsmount *m, *mnt = path->mnt; 1495 struct mount *m;
1496 struct mount *mnt = real_mount(path->mnt);
1694 int recurse = flag & MS_REC; 1497 int recurse = flag & MS_REC;
1695 int type; 1498 int type;
1696 int err = 0; 1499 int err = 0;
@@ -1730,7 +1533,7 @@ static int do_loopback(struct path *path, char *old_name,
1730{ 1533{
1731 LIST_HEAD(umount_list); 1534 LIST_HEAD(umount_list);
1732 struct path old_path; 1535 struct path old_path;
1733 struct vfsmount *mnt = NULL; 1536 struct mount *mnt = NULL, *old;
1734 int err = mount_is_safe(path); 1537 int err = mount_is_safe(path);
1735 if (err) 1538 if (err)
1736 return err; 1539 return err;
@@ -1744,18 +1547,20 @@ static int do_loopback(struct path *path, char *old_name,
1744 if (err) 1547 if (err)
1745 goto out; 1548 goto out;
1746 1549
1550 old = real_mount(old_path.mnt);
1551
1747 err = -EINVAL; 1552 err = -EINVAL;
1748 if (IS_MNT_UNBINDABLE(old_path.mnt)) 1553 if (IS_MNT_UNBINDABLE(old))
1749 goto out2; 1554 goto out2;
1750 1555
1751 if (!check_mnt(path->mnt) || !check_mnt(old_path.mnt)) 1556 if (!check_mnt(real_mount(path->mnt)) || !check_mnt(old))
1752 goto out2; 1557 goto out2;
1753 1558
1754 err = -ENOMEM; 1559 err = -ENOMEM;
1755 if (recurse) 1560 if (recurse)
1756 mnt = copy_tree(old_path.mnt, old_path.dentry, 0); 1561 mnt = copy_tree(old, old_path.dentry, 0);
1757 else 1562 else
1758 mnt = clone_mnt(old_path.mnt, old_path.dentry, 0); 1563 mnt = clone_mnt(old, old_path.dentry, 0);
1759 1564
1760 if (!mnt) 1565 if (!mnt)
1761 goto out2; 1566 goto out2;
@@ -1785,9 +1590,9 @@ static int change_mount_flags(struct vfsmount *mnt, int ms_flags)
1785 return 0; 1590 return 0;
1786 1591
1787 if (readonly_request) 1592 if (readonly_request)
1788 error = mnt_make_readonly(mnt); 1593 error = mnt_make_readonly(real_mount(mnt));
1789 else 1594 else
1790 __mnt_unmake_readonly(mnt); 1595 __mnt_unmake_readonly(real_mount(mnt));
1791 return error; 1596 return error;
1792} 1597}
1793 1598
@@ -1801,11 +1606,12 @@ static int do_remount(struct path *path, int flags, int mnt_flags,
1801{ 1606{
1802 int err; 1607 int err;
1803 struct super_block *sb = path->mnt->mnt_sb; 1608 struct super_block *sb = path->mnt->mnt_sb;
1609 struct mount *mnt = real_mount(path->mnt);
1804 1610
1805 if (!capable(CAP_SYS_ADMIN)) 1611 if (!capable(CAP_SYS_ADMIN))
1806 return -EPERM; 1612 return -EPERM;
1807 1613
1808 if (!check_mnt(path->mnt)) 1614 if (!check_mnt(mnt))
1809 return -EINVAL; 1615 return -EINVAL;
1810 1616
1811 if (path->dentry != path->mnt->mnt_root) 1617 if (path->dentry != path->mnt->mnt_root)
@@ -1822,22 +1628,22 @@ static int do_remount(struct path *path, int flags, int mnt_flags,
1822 err = do_remount_sb(sb, flags, data, 0); 1628 err = do_remount_sb(sb, flags, data, 0);
1823 if (!err) { 1629 if (!err) {
1824 br_write_lock(vfsmount_lock); 1630 br_write_lock(vfsmount_lock);
1825 mnt_flags |= path->mnt->mnt_flags & MNT_PROPAGATION_MASK; 1631 mnt_flags |= mnt->mnt.mnt_flags & MNT_PROPAGATION_MASK;
1826 path->mnt->mnt_flags = mnt_flags; 1632 mnt->mnt.mnt_flags = mnt_flags;
1827 br_write_unlock(vfsmount_lock); 1633 br_write_unlock(vfsmount_lock);
1828 } 1634 }
1829 up_write(&sb->s_umount); 1635 up_write(&sb->s_umount);
1830 if (!err) { 1636 if (!err) {
1831 br_write_lock(vfsmount_lock); 1637 br_write_lock(vfsmount_lock);
1832 touch_mnt_namespace(path->mnt->mnt_ns); 1638 touch_mnt_namespace(mnt->mnt_ns);
1833 br_write_unlock(vfsmount_lock); 1639 br_write_unlock(vfsmount_lock);
1834 } 1640 }
1835 return err; 1641 return err;
1836} 1642}
1837 1643
1838static inline int tree_contains_unbindable(struct vfsmount *mnt) 1644static inline int tree_contains_unbindable(struct mount *mnt)
1839{ 1645{
1840 struct vfsmount *p; 1646 struct mount *p;
1841 for (p = mnt; p; p = next_mnt(p, mnt)) { 1647 for (p = mnt; p; p = next_mnt(p, mnt)) {
1842 if (IS_MNT_UNBINDABLE(p)) 1648 if (IS_MNT_UNBINDABLE(p))
1843 return 1; 1649 return 1;
@@ -1848,7 +1654,8 @@ static inline int tree_contains_unbindable(struct vfsmount *mnt)
1848static int do_move_mount(struct path *path, char *old_name) 1654static int do_move_mount(struct path *path, char *old_name)
1849{ 1655{
1850 struct path old_path, parent_path; 1656 struct path old_path, parent_path;
1851 struct vfsmount *p; 1657 struct mount *p;
1658 struct mount *old;
1852 int err = 0; 1659 int err = 0;
1853 if (!capable(CAP_SYS_ADMIN)) 1660 if (!capable(CAP_SYS_ADMIN))
1854 return -EPERM; 1661 return -EPERM;
@@ -1862,8 +1669,11 @@ static int do_move_mount(struct path *path, char *old_name)
1862 if (err < 0) 1669 if (err < 0)
1863 goto out; 1670 goto out;
1864 1671
1672 old = real_mount(old_path.mnt);
1673 p = real_mount(path->mnt);
1674
1865 err = -EINVAL; 1675 err = -EINVAL;
1866 if (!check_mnt(path->mnt) || !check_mnt(old_path.mnt)) 1676 if (!check_mnt(p) || !check_mnt(old))
1867 goto out1; 1677 goto out1;
1868 1678
1869 if (d_unlinked(path->dentry)) 1679 if (d_unlinked(path->dentry))
@@ -1873,7 +1683,7 @@ static int do_move_mount(struct path *path, char *old_name)
1873 if (old_path.dentry != old_path.mnt->mnt_root) 1683 if (old_path.dentry != old_path.mnt->mnt_root)
1874 goto out1; 1684 goto out1;
1875 1685
1876 if (!mnt_has_parent(old_path.mnt)) 1686 if (!mnt_has_parent(old))
1877 goto out1; 1687 goto out1;
1878 1688
1879 if (S_ISDIR(path->dentry->d_inode->i_mode) != 1689 if (S_ISDIR(path->dentry->d_inode->i_mode) !=
@@ -1882,27 +1692,26 @@ static int do_move_mount(struct path *path, char *old_name)
1882 /* 1692 /*
1883 * Don't move a mount residing in a shared parent. 1693 * Don't move a mount residing in a shared parent.
1884 */ 1694 */
1885 if (IS_MNT_SHARED(old_path.mnt->mnt_parent)) 1695 if (IS_MNT_SHARED(old->mnt_parent))
1886 goto out1; 1696 goto out1;
1887 /* 1697 /*
1888 * Don't move a mount tree containing unbindable mounts to a destination 1698 * Don't move a mount tree containing unbindable mounts to a destination
1889 * mount which is shared. 1699 * mount which is shared.
1890 */ 1700 */
1891 if (IS_MNT_SHARED(path->mnt) && 1701 if (IS_MNT_SHARED(p) && tree_contains_unbindable(old))
1892 tree_contains_unbindable(old_path.mnt))
1893 goto out1; 1702 goto out1;
1894 err = -ELOOP; 1703 err = -ELOOP;
1895 for (p = path->mnt; mnt_has_parent(p); p = p->mnt_parent) 1704 for (; mnt_has_parent(p); p = p->mnt_parent)
1896 if (p == old_path.mnt) 1705 if (p == old)
1897 goto out1; 1706 goto out1;
1898 1707
1899 err = attach_recursive_mnt(old_path.mnt, path, &parent_path); 1708 err = attach_recursive_mnt(old, path, &parent_path);
1900 if (err) 1709 if (err)
1901 goto out1; 1710 goto out1;
1902 1711
1903 /* if the mount is moved, it should no longer be expire 1712 /* if the mount is moved, it should no longer be expire
1904 * automatically */ 1713 * automatically */
1905 list_del_init(&old_path.mnt->mnt_expire); 1714 list_del_init(&old->mnt_expire);
1906out1: 1715out1:
1907 unlock_mount(path); 1716 unlock_mount(path);
1908out: 1717out:
@@ -1953,7 +1762,7 @@ do_kern_mount(const char *fstype, int flags, const char *name, void *data)
1953/* 1762/*
1954 * add a mount into a namespace's mount tree 1763 * add a mount into a namespace's mount tree
1955 */ 1764 */
1956static int do_add_mount(struct vfsmount *newmnt, struct path *path, int mnt_flags) 1765static int do_add_mount(struct mount *newmnt, struct path *path, int mnt_flags)
1957{ 1766{
1958 int err; 1767 int err;
1959 1768
@@ -1964,20 +1773,20 @@ static int do_add_mount(struct vfsmount *newmnt, struct path *path, int mnt_flag
1964 return err; 1773 return err;
1965 1774
1966 err = -EINVAL; 1775 err = -EINVAL;
1967 if (!(mnt_flags & MNT_SHRINKABLE) && !check_mnt(path->mnt)) 1776 if (!(mnt_flags & MNT_SHRINKABLE) && !check_mnt(real_mount(path->mnt)))
1968 goto unlock; 1777 goto unlock;
1969 1778
1970 /* Refuse the same filesystem on the same mount point */ 1779 /* Refuse the same filesystem on the same mount point */
1971 err = -EBUSY; 1780 err = -EBUSY;
1972 if (path->mnt->mnt_sb == newmnt->mnt_sb && 1781 if (path->mnt->mnt_sb == newmnt->mnt.mnt_sb &&
1973 path->mnt->mnt_root == path->dentry) 1782 path->mnt->mnt_root == path->dentry)
1974 goto unlock; 1783 goto unlock;
1975 1784
1976 err = -EINVAL; 1785 err = -EINVAL;
1977 if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode)) 1786 if (S_ISLNK(newmnt->mnt.mnt_root->d_inode->i_mode))
1978 goto unlock; 1787 goto unlock;
1979 1788
1980 newmnt->mnt_flags = mnt_flags; 1789 newmnt->mnt.mnt_flags = mnt_flags;
1981 err = graft_tree(newmnt, path); 1790 err = graft_tree(newmnt, path);
1982 1791
1983unlock: 1792unlock:
@@ -2006,7 +1815,7 @@ static int do_new_mount(struct path *path, char *type, int flags,
2006 if (IS_ERR(mnt)) 1815 if (IS_ERR(mnt))
2007 return PTR_ERR(mnt); 1816 return PTR_ERR(mnt);
2008 1817
2009 err = do_add_mount(mnt, path, mnt_flags); 1818 err = do_add_mount(real_mount(mnt), path, mnt_flags);
2010 if (err) 1819 if (err)
2011 mntput(mnt); 1820 mntput(mnt);
2012 return err; 1821 return err;
@@ -2014,11 +1823,12 @@ static int do_new_mount(struct path *path, char *type, int flags,
2014 1823
2015int finish_automount(struct vfsmount *m, struct path *path) 1824int finish_automount(struct vfsmount *m, struct path *path)
2016{ 1825{
1826 struct mount *mnt = real_mount(m);
2017 int err; 1827 int err;
2018 /* The new mount record should have at least 2 refs to prevent it being 1828 /* The new mount record should have at least 2 refs to prevent it being
2019 * expired before we get a chance to add it 1829 * expired before we get a chance to add it
2020 */ 1830 */
2021 BUG_ON(mnt_get_count(m) < 2); 1831 BUG_ON(mnt_get_count(mnt) < 2);
2022 1832
2023 if (m->mnt_sb == path->mnt->mnt_sb && 1833 if (m->mnt_sb == path->mnt->mnt_sb &&
2024 m->mnt_root == path->dentry) { 1834 m->mnt_root == path->dentry) {
@@ -2026,15 +1836,15 @@ int finish_automount(struct vfsmount *m, struct path *path)
2026 goto fail; 1836 goto fail;
2027 } 1837 }
2028 1838
2029 err = do_add_mount(m, path, path->mnt->mnt_flags | MNT_SHRINKABLE); 1839 err = do_add_mount(mnt, path, path->mnt->mnt_flags | MNT_SHRINKABLE);
2030 if (!err) 1840 if (!err)
2031 return 0; 1841 return 0;
2032fail: 1842fail:
2033 /* remove m from any expiration list it may be on */ 1843 /* remove m from any expiration list it may be on */
2034 if (!list_empty(&m->mnt_expire)) { 1844 if (!list_empty(&mnt->mnt_expire)) {
2035 down_write(&namespace_sem); 1845 down_write(&namespace_sem);
2036 br_write_lock(vfsmount_lock); 1846 br_write_lock(vfsmount_lock);
2037 list_del_init(&m->mnt_expire); 1847 list_del_init(&mnt->mnt_expire);
2038 br_write_unlock(vfsmount_lock); 1848 br_write_unlock(vfsmount_lock);
2039 up_write(&namespace_sem); 1849 up_write(&namespace_sem);
2040 } 1850 }
@@ -2053,7 +1863,7 @@ void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list)
2053 down_write(&namespace_sem); 1863 down_write(&namespace_sem);
2054 br_write_lock(vfsmount_lock); 1864 br_write_lock(vfsmount_lock);
2055 1865
2056 list_add_tail(&mnt->mnt_expire, expiry_list); 1866 list_add_tail(&real_mount(mnt)->mnt_expire, expiry_list);
2057 1867
2058 br_write_unlock(vfsmount_lock); 1868 br_write_unlock(vfsmount_lock);
2059 up_write(&namespace_sem); 1869 up_write(&namespace_sem);
@@ -2067,7 +1877,7 @@ EXPORT_SYMBOL(mnt_set_expiry);
2067 */ 1877 */
2068void mark_mounts_for_expiry(struct list_head *mounts) 1878void mark_mounts_for_expiry(struct list_head *mounts)
2069{ 1879{
2070 struct vfsmount *mnt, *next; 1880 struct mount *mnt, *next;
2071 LIST_HEAD(graveyard); 1881 LIST_HEAD(graveyard);
2072 LIST_HEAD(umounts); 1882 LIST_HEAD(umounts);
2073 1883
@@ -2090,7 +1900,7 @@ void mark_mounts_for_expiry(struct list_head *mounts)
2090 list_move(&mnt->mnt_expire, &graveyard); 1900 list_move(&mnt->mnt_expire, &graveyard);
2091 } 1901 }
2092 while (!list_empty(&graveyard)) { 1902 while (!list_empty(&graveyard)) {
2093 mnt = list_first_entry(&graveyard, struct vfsmount, mnt_expire); 1903 mnt = list_first_entry(&graveyard, struct mount, mnt_expire);
2094 touch_mnt_namespace(mnt->mnt_ns); 1904 touch_mnt_namespace(mnt->mnt_ns);
2095 umount_tree(mnt, 1, &umounts); 1905 umount_tree(mnt, 1, &umounts);
2096 } 1906 }
@@ -2108,9 +1918,9 @@ EXPORT_SYMBOL_GPL(mark_mounts_for_expiry);
2108 * search the list of submounts for a given mountpoint, and move any 1918 * search the list of submounts for a given mountpoint, and move any
2109 * shrinkable submounts to the 'graveyard' list. 1919 * shrinkable submounts to the 'graveyard' list.
2110 */ 1920 */
2111static int select_submounts(struct vfsmount *parent, struct list_head *graveyard) 1921static int select_submounts(struct mount *parent, struct list_head *graveyard)
2112{ 1922{
2113 struct vfsmount *this_parent = parent; 1923 struct mount *this_parent = parent;
2114 struct list_head *next; 1924 struct list_head *next;
2115 int found = 0; 1925 int found = 0;
2116 1926
@@ -2119,10 +1929,10 @@ repeat:
2119resume: 1929resume:
2120 while (next != &this_parent->mnt_mounts) { 1930 while (next != &this_parent->mnt_mounts) {
2121 struct list_head *tmp = next; 1931 struct list_head *tmp = next;
2122 struct vfsmount *mnt = list_entry(tmp, struct vfsmount, mnt_child); 1932 struct mount *mnt = list_entry(tmp, struct mount, mnt_child);
2123 1933
2124 next = tmp->next; 1934 next = tmp->next;
2125 if (!(mnt->mnt_flags & MNT_SHRINKABLE)) 1935 if (!(mnt->mnt.mnt_flags & MNT_SHRINKABLE))
2126 continue; 1936 continue;
2127 /* 1937 /*
2128 * Descend a level if the d_mounts list is non-empty. 1938 * Descend a level if the d_mounts list is non-empty.
@@ -2154,15 +1964,15 @@ resume:
2154 * 1964 *
2155 * vfsmount_lock must be held for write 1965 * vfsmount_lock must be held for write
2156 */ 1966 */
2157static void shrink_submounts(struct vfsmount *mnt, struct list_head *umounts) 1967static void shrink_submounts(struct mount *mnt, struct list_head *umounts)
2158{ 1968{
2159 LIST_HEAD(graveyard); 1969 LIST_HEAD(graveyard);
2160 struct vfsmount *m; 1970 struct mount *m;
2161 1971
2162 /* extract submounts of 'mountpoint' from the expiration list */ 1972 /* extract submounts of 'mountpoint' from the expiration list */
2163 while (select_submounts(mnt, &graveyard)) { 1973 while (select_submounts(mnt, &graveyard)) {
2164 while (!list_empty(&graveyard)) { 1974 while (!list_empty(&graveyard)) {
2165 m = list_first_entry(&graveyard, struct vfsmount, 1975 m = list_first_entry(&graveyard, struct mount,
2166 mnt_expire); 1976 mnt_expire);
2167 touch_mnt_namespace(m->mnt_ns); 1977 touch_mnt_namespace(m->mnt_ns);
2168 umount_tree(m, 1, umounts); 1978 umount_tree(m, 1, umounts);
@@ -2349,12 +2159,13 @@ static struct mnt_namespace *alloc_mnt_ns(void)
2349 2159
2350void mnt_make_longterm(struct vfsmount *mnt) 2160void mnt_make_longterm(struct vfsmount *mnt)
2351{ 2161{
2352 __mnt_make_longterm(mnt); 2162 __mnt_make_longterm(real_mount(mnt));
2353} 2163}
2354 2164
2355void mnt_make_shortterm(struct vfsmount *mnt) 2165void mnt_make_shortterm(struct vfsmount *m)
2356{ 2166{
2357#ifdef CONFIG_SMP 2167#ifdef CONFIG_SMP
2168 struct mount *mnt = real_mount(m);
2358 if (atomic_add_unless(&mnt->mnt_longterm, -1, 1)) 2169 if (atomic_add_unless(&mnt->mnt_longterm, -1, 1))
2359 return; 2170 return;
2360 br_write_lock(vfsmount_lock); 2171 br_write_lock(vfsmount_lock);
@@ -2372,7 +2183,9 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns,
2372{ 2183{
2373 struct mnt_namespace *new_ns; 2184 struct mnt_namespace *new_ns;
2374 struct vfsmount *rootmnt = NULL, *pwdmnt = NULL; 2185 struct vfsmount *rootmnt = NULL, *pwdmnt = NULL;
2375 struct vfsmount *p, *q; 2186 struct mount *p, *q;
2187 struct mount *old = mnt_ns->root;
2188 struct mount *new;
2376 2189
2377 new_ns = alloc_mnt_ns(); 2190 new_ns = alloc_mnt_ns();
2378 if (IS_ERR(new_ns)) 2191 if (IS_ERR(new_ns))
@@ -2380,15 +2193,15 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns,
2380 2193
2381 down_write(&namespace_sem); 2194 down_write(&namespace_sem);
2382 /* First pass: copy the tree topology */ 2195 /* First pass: copy the tree topology */
2383 new_ns->root = copy_tree(mnt_ns->root, mnt_ns->root->mnt_root, 2196 new = copy_tree(old, old->mnt.mnt_root, CL_COPY_ALL | CL_EXPIRE);
2384 CL_COPY_ALL | CL_EXPIRE); 2197 if (!new) {
2385 if (!new_ns->root) {
2386 up_write(&namespace_sem); 2198 up_write(&namespace_sem);
2387 kfree(new_ns); 2199 kfree(new_ns);
2388 return ERR_PTR(-ENOMEM); 2200 return ERR_PTR(-ENOMEM);
2389 } 2201 }
2202 new_ns->root = new;
2390 br_write_lock(vfsmount_lock); 2203 br_write_lock(vfsmount_lock);
2391 list_add_tail(&new_ns->list, &new_ns->root->mnt_list); 2204 list_add_tail(&new_ns->list, &new->mnt_list);
2392 br_write_unlock(vfsmount_lock); 2205 br_write_unlock(vfsmount_lock);
2393 2206
2394 /* 2207 /*
@@ -2396,27 +2209,27 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns,
2396 * as belonging to new namespace. We have already acquired a private 2209 * as belonging to new namespace. We have already acquired a private
2397 * fs_struct, so tsk->fs->lock is not needed. 2210 * fs_struct, so tsk->fs->lock is not needed.
2398 */ 2211 */
2399 p = mnt_ns->root; 2212 p = old;
2400 q = new_ns->root; 2213 q = new;
2401 while (p) { 2214 while (p) {
2402 q->mnt_ns = new_ns; 2215 q->mnt_ns = new_ns;
2403 __mnt_make_longterm(q); 2216 __mnt_make_longterm(q);
2404 if (fs) { 2217 if (fs) {
2405 if (p == fs->root.mnt) { 2218 if (&p->mnt == fs->root.mnt) {
2406 fs->root.mnt = mntget(q); 2219 fs->root.mnt = mntget(&q->mnt);
2407 __mnt_make_longterm(q); 2220 __mnt_make_longterm(q);
2408 mnt_make_shortterm(p); 2221 mnt_make_shortterm(&p->mnt);
2409 rootmnt = p; 2222 rootmnt = &p->mnt;
2410 } 2223 }
2411 if (p == fs->pwd.mnt) { 2224 if (&p->mnt == fs->pwd.mnt) {
2412 fs->pwd.mnt = mntget(q); 2225 fs->pwd.mnt = mntget(&q->mnt);
2413 __mnt_make_longterm(q); 2226 __mnt_make_longterm(q);
2414 mnt_make_shortterm(p); 2227 mnt_make_shortterm(&p->mnt);
2415 pwdmnt = p; 2228 pwdmnt = &p->mnt;
2416 } 2229 }
2417 } 2230 }
2418 p = next_mnt(p, mnt_ns->root); 2231 p = next_mnt(p, old);
2419 q = next_mnt(q, new_ns->root); 2232 q = next_mnt(q, new);
2420 } 2233 }
2421 up_write(&namespace_sem); 2234 up_write(&namespace_sem);
2422 2235
@@ -2449,18 +2262,17 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
2449 * create_mnt_ns - creates a private namespace and adds a root filesystem 2262 * create_mnt_ns - creates a private namespace and adds a root filesystem
2450 * @mnt: pointer to the new root filesystem mountpoint 2263 * @mnt: pointer to the new root filesystem mountpoint
2451 */ 2264 */
2452static struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt) 2265static struct mnt_namespace *create_mnt_ns(struct vfsmount *m)
2453{ 2266{
2454 struct mnt_namespace *new_ns; 2267 struct mnt_namespace *new_ns = alloc_mnt_ns();
2455
2456 new_ns = alloc_mnt_ns();
2457 if (!IS_ERR(new_ns)) { 2268 if (!IS_ERR(new_ns)) {
2269 struct mount *mnt = real_mount(m);
2458 mnt->mnt_ns = new_ns; 2270 mnt->mnt_ns = new_ns;
2459 __mnt_make_longterm(mnt); 2271 __mnt_make_longterm(mnt);
2460 new_ns->root = mnt; 2272 new_ns->root = mnt;
2461 list_add(&new_ns->list, &new_ns->root->mnt_list); 2273 list_add(&new_ns->list, &mnt->mnt_list);
2462 } else { 2274 } else {
2463 mntput(mnt); 2275 mntput(m);
2464 } 2276 }
2465 return new_ns; 2277 return new_ns;
2466} 2278}
@@ -2541,21 +2353,21 @@ out_type:
2541 * 2353 *
2542 * namespace_sem or vfsmount_lock is held 2354 * namespace_sem or vfsmount_lock is held
2543 */ 2355 */
2544bool is_path_reachable(struct vfsmount *mnt, struct dentry *dentry, 2356bool is_path_reachable(struct mount *mnt, struct dentry *dentry,
2545 const struct path *root) 2357 const struct path *root)
2546{ 2358{
2547 while (mnt != root->mnt && mnt_has_parent(mnt)) { 2359 while (&mnt->mnt != root->mnt && mnt_has_parent(mnt)) {
2548 dentry = mnt->mnt_mountpoint; 2360 dentry = mnt->mnt_mountpoint;
2549 mnt = mnt->mnt_parent; 2361 mnt = mnt->mnt_parent;
2550 } 2362 }
2551 return mnt == root->mnt && is_subdir(dentry, root->dentry); 2363 return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry);
2552} 2364}
2553 2365
2554int path_is_under(struct path *path1, struct path *path2) 2366int path_is_under(struct path *path1, struct path *path2)
2555{ 2367{
2556 int res; 2368 int res;
2557 br_read_lock(vfsmount_lock); 2369 br_read_lock(vfsmount_lock);
2558 res = is_path_reachable(path1->mnt, path1->dentry, path2); 2370 res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2);
2559 br_read_unlock(vfsmount_lock); 2371 br_read_unlock(vfsmount_lock);
2560 return res; 2372 return res;
2561} 2373}
@@ -2590,6 +2402,7 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
2590 const char __user *, put_old) 2402 const char __user *, put_old)
2591{ 2403{
2592 struct path new, old, parent_path, root_parent, root; 2404 struct path new, old, parent_path, root_parent, root;
2405 struct mount *new_mnt, *root_mnt;
2593 int error; 2406 int error;
2594 2407
2595 if (!capable(CAP_SYS_ADMIN)) 2408 if (!capable(CAP_SYS_ADMIN))
@@ -2613,11 +2426,13 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
2613 goto out3; 2426 goto out3;
2614 2427
2615 error = -EINVAL; 2428 error = -EINVAL;
2616 if (IS_MNT_SHARED(old.mnt) || 2429 new_mnt = real_mount(new.mnt);
2617 IS_MNT_SHARED(new.mnt->mnt_parent) || 2430 root_mnt = real_mount(root.mnt);
2618 IS_MNT_SHARED(root.mnt->mnt_parent)) 2431 if (IS_MNT_SHARED(real_mount(old.mnt)) ||
2432 IS_MNT_SHARED(new_mnt->mnt_parent) ||
2433 IS_MNT_SHARED(root_mnt->mnt_parent))
2619 goto out4; 2434 goto out4;
2620 if (!check_mnt(root.mnt) || !check_mnt(new.mnt)) 2435 if (!check_mnt(root_mnt) || !check_mnt(new_mnt))
2621 goto out4; 2436 goto out4;
2622 error = -ENOENT; 2437 error = -ENOENT;
2623 if (d_unlinked(new.dentry)) 2438 if (d_unlinked(new.dentry))
@@ -2631,22 +2446,22 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
2631 error = -EINVAL; 2446 error = -EINVAL;
2632 if (root.mnt->mnt_root != root.dentry) 2447 if (root.mnt->mnt_root != root.dentry)
2633 goto out4; /* not a mountpoint */ 2448 goto out4; /* not a mountpoint */
2634 if (!mnt_has_parent(root.mnt)) 2449 if (!mnt_has_parent(root_mnt))
2635 goto out4; /* not attached */ 2450 goto out4; /* not attached */
2636 if (new.mnt->mnt_root != new.dentry) 2451 if (new.mnt->mnt_root != new.dentry)
2637 goto out4; /* not a mountpoint */ 2452 goto out4; /* not a mountpoint */
2638 if (!mnt_has_parent(new.mnt)) 2453 if (!mnt_has_parent(new_mnt))
2639 goto out4; /* not attached */ 2454 goto out4; /* not attached */
2640 /* make sure we can reach put_old from new_root */ 2455 /* make sure we can reach put_old from new_root */
2641 if (!is_path_reachable(old.mnt, old.dentry, &new)) 2456 if (!is_path_reachable(real_mount(old.mnt), old.dentry, &new))
2642 goto out4; 2457 goto out4;
2643 br_write_lock(vfsmount_lock); 2458 br_write_lock(vfsmount_lock);
2644 detach_mnt(new.mnt, &parent_path); 2459 detach_mnt(new_mnt, &parent_path);
2645 detach_mnt(root.mnt, &root_parent); 2460 detach_mnt(root_mnt, &root_parent);
2646 /* mount old root on put_old */ 2461 /* mount old root on put_old */
2647 attach_mnt(root.mnt, &old); 2462 attach_mnt(root_mnt, &old);
2648 /* mount new_root on / */ 2463 /* mount new_root on / */
2649 attach_mnt(new.mnt, &root_parent); 2464 attach_mnt(new_mnt, &root_parent);
2650 touch_mnt_namespace(current->nsproxy->mnt_ns); 2465 touch_mnt_namespace(current->nsproxy->mnt_ns);
2651 br_write_unlock(vfsmount_lock); 2466 br_write_unlock(vfsmount_lock);
2652 chroot_fs_refs(&root, &new); 2467 chroot_fs_refs(&root, &new);
@@ -2684,8 +2499,8 @@ static void __init init_mount_tree(void)
2684 init_task.nsproxy->mnt_ns = ns; 2499 init_task.nsproxy->mnt_ns = ns;
2685 get_mnt_ns(ns); 2500 get_mnt_ns(ns);
2686 2501
2687 root.mnt = ns->root; 2502 root.mnt = mnt;
2688 root.dentry = ns->root->mnt_root; 2503 root.dentry = mnt->mnt_root;
2689 2504
2690 set_fs_pwd(current->fs, &root); 2505 set_fs_pwd(current->fs, &root);
2691 set_fs_root(current->fs, &root); 2506 set_fs_root(current->fs, &root);
@@ -2698,7 +2513,7 @@ void __init mnt_init(void)
2698 2513
2699 init_rwsem(&namespace_sem); 2514 init_rwsem(&namespace_sem);
2700 2515
2701 mnt_cache = kmem_cache_create("mnt_cache", sizeof(struct vfsmount), 2516 mnt_cache = kmem_cache_create("mnt_cache", sizeof(struct mount),
2702 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL); 2517 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);
2703 2518
2704 mount_hashtable = (struct list_head *)__get_free_page(GFP_ATOMIC); 2519 mount_hashtable = (struct list_head *)__get_free_page(GFP_ATOMIC);
@@ -2766,5 +2581,5 @@ EXPORT_SYMBOL(kern_unmount);
2766 2581
2767bool our_mnt(struct vfsmount *mnt) 2582bool our_mnt(struct vfsmount *mnt)
2768{ 2583{
2769 return check_mnt(mnt); 2584 return check_mnt(real_mount(mnt));
2770} 2585}
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index 9c51f621e901..aeed93a6bde0 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -30,15 +30,15 @@ static void ncp_do_readdir(struct file *, void *, filldir_t,
30 30
31static int ncp_readdir(struct file *, void *, filldir_t); 31static int ncp_readdir(struct file *, void *, filldir_t);
32 32
33static int ncp_create(struct inode *, struct dentry *, int, struct nameidata *); 33static int ncp_create(struct inode *, struct dentry *, umode_t, struct nameidata *);
34static struct dentry *ncp_lookup(struct inode *, struct dentry *, struct nameidata *); 34static struct dentry *ncp_lookup(struct inode *, struct dentry *, struct nameidata *);
35static int ncp_unlink(struct inode *, struct dentry *); 35static int ncp_unlink(struct inode *, struct dentry *);
36static int ncp_mkdir(struct inode *, struct dentry *, int); 36static int ncp_mkdir(struct inode *, struct dentry *, umode_t);
37static int ncp_rmdir(struct inode *, struct dentry *); 37static int ncp_rmdir(struct inode *, struct dentry *);
38static int ncp_rename(struct inode *, struct dentry *, 38static int ncp_rename(struct inode *, struct dentry *,
39 struct inode *, struct dentry *); 39 struct inode *, struct dentry *);
40static int ncp_mknod(struct inode * dir, struct dentry *dentry, 40static int ncp_mknod(struct inode * dir, struct dentry *dentry,
41 int mode, dev_t rdev); 41 umode_t mode, dev_t rdev);
42#if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) 42#if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS)
43extern int ncp_symlink(struct inode *, struct dentry *, const char *); 43extern int ncp_symlink(struct inode *, struct dentry *, const char *);
44#else 44#else
@@ -919,7 +919,7 @@ out_close:
919 goto out; 919 goto out;
920} 920}
921 921
922int ncp_create_new(struct inode *dir, struct dentry *dentry, int mode, 922int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode,
923 dev_t rdev, __le32 attributes) 923 dev_t rdev, __le32 attributes)
924{ 924{
925 struct ncp_server *server = NCP_SERVER(dir); 925 struct ncp_server *server = NCP_SERVER(dir);
@@ -928,7 +928,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, int mode,
928 int opmode; 928 int opmode;
929 __u8 __name[NCP_MAXPATHLEN + 1]; 929 __u8 __name[NCP_MAXPATHLEN + 1];
930 930
931 PPRINTK("ncp_create_new: creating %s/%s, mode=%x\n", 931 PPRINTK("ncp_create_new: creating %s/%s, mode=%hx\n",
932 dentry->d_parent->d_name.name, dentry->d_name.name, mode); 932 dentry->d_parent->d_name.name, dentry->d_name.name, mode);
933 933
934 ncp_age_dentry(server, dentry); 934 ncp_age_dentry(server, dentry);
@@ -979,13 +979,13 @@ out:
979 return error; 979 return error;
980} 980}
981 981
982static int ncp_create(struct inode *dir, struct dentry *dentry, int mode, 982static int ncp_create(struct inode *dir, struct dentry *dentry, umode_t mode,
983 struct nameidata *nd) 983 struct nameidata *nd)
984{ 984{
985 return ncp_create_new(dir, dentry, mode, 0, 0); 985 return ncp_create_new(dir, dentry, mode, 0, 0);
986} 986}
987 987
988static int ncp_mkdir(struct inode *dir, struct dentry *dentry, int mode) 988static int ncp_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
989{ 989{
990 struct ncp_entry_info finfo; 990 struct ncp_entry_info finfo;
991 struct ncp_server *server = NCP_SERVER(dir); 991 struct ncp_server *server = NCP_SERVER(dir);
@@ -1201,12 +1201,12 @@ out:
1201} 1201}
1202 1202
1203static int ncp_mknod(struct inode * dir, struct dentry *dentry, 1203static int ncp_mknod(struct inode * dir, struct dentry *dentry,
1204 int mode, dev_t rdev) 1204 umode_t mode, dev_t rdev)
1205{ 1205{
1206 if (!new_valid_dev(rdev)) 1206 if (!new_valid_dev(rdev))
1207 return -EINVAL; 1207 return -EINVAL;
1208 if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber)) { 1208 if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber)) {
1209 DPRINTK(KERN_DEBUG "ncp_mknod: mode = 0%o\n", mode); 1209 DPRINTK(KERN_DEBUG "ncp_mknod: mode = 0%ho\n", mode);
1210 return ncp_create_new(dir, dentry, mode, rdev, 0); 1210 return ncp_create_new(dir, dentry, mode, rdev, 0);
1211 } 1211 }
1212 return -EPERM; /* Strange, but true */ 1212 return -EPERM; /* Strange, but true */
diff --git a/fs/ncpfs/ncplib_kernel.h b/fs/ncpfs/ncplib_kernel.h
index 09881e6aa5ad..32c06587351a 100644
--- a/fs/ncpfs/ncplib_kernel.h
+++ b/fs/ncpfs/ncplib_kernel.h
@@ -114,7 +114,7 @@ int ncp_dirhandle_alloc(struct ncp_server *, __u8 vol, __le32 dirent, __u8 *dirh
114int ncp_dirhandle_free(struct ncp_server *, __u8 dirhandle); 114int ncp_dirhandle_free(struct ncp_server *, __u8 dirhandle);
115 115
116int ncp_create_new(struct inode *dir, struct dentry *dentry, 116int ncp_create_new(struct inode *dir, struct dentry *dentry,
117 int mode, dev_t rdev, __le32 attributes); 117 umode_t mode, dev_t rdev, __le32 attributes);
118 118
119static inline int ncp_is_nfs_extras(struct ncp_server* server, unsigned int volnum) { 119static inline int ncp_is_nfs_extras(struct ncp_server* server, unsigned int volnum) {
120#ifdef CONFIG_NCPFS_NFS_NS 120#ifdef CONFIG_NCPFS_NFS_NS
diff --git a/fs/ncpfs/symlink.c b/fs/ncpfs/symlink.c
index 661f861d80c6..52439ddc8de0 100644
--- a/fs/ncpfs/symlink.c
+++ b/fs/ncpfs/symlink.c
@@ -108,7 +108,7 @@ int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) {
108 char *rawlink; 108 char *rawlink;
109 int length, err, i, outlen; 109 int length, err, i, outlen;
110 int kludge; 110 int kludge;
111 int mode; 111 umode_t mode;
112 __le32 attr; 112 __le32 attr;
113 unsigned int hdr; 113 unsigned int hdr;
114 114
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 23be134b3193..fd9a872fada0 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -47,13 +47,13 @@ static int nfs_opendir(struct inode *, struct file *);
47static int nfs_closedir(struct inode *, struct file *); 47static int nfs_closedir(struct inode *, struct file *);
48static int nfs_readdir(struct file *, void *, filldir_t); 48static int nfs_readdir(struct file *, void *, filldir_t);
49static struct dentry *nfs_lookup(struct inode *, struct dentry *, struct nameidata *); 49static struct dentry *nfs_lookup(struct inode *, struct dentry *, struct nameidata *);
50static int nfs_create(struct inode *, struct dentry *, int, struct nameidata *); 50static int nfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *);
51static int nfs_mkdir(struct inode *, struct dentry *, int); 51static int nfs_mkdir(struct inode *, struct dentry *, umode_t);
52static int nfs_rmdir(struct inode *, struct dentry *); 52static int nfs_rmdir(struct inode *, struct dentry *);
53static int nfs_unlink(struct inode *, struct dentry *); 53static int nfs_unlink(struct inode *, struct dentry *);
54static int nfs_symlink(struct inode *, struct dentry *, const char *); 54static int nfs_symlink(struct inode *, struct dentry *, const char *);
55static int nfs_link(struct dentry *, struct inode *, struct dentry *); 55static int nfs_link(struct dentry *, struct inode *, struct dentry *);
56static int nfs_mknod(struct inode *, struct dentry *, int, dev_t); 56static int nfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
57static int nfs_rename(struct inode *, struct dentry *, 57static int nfs_rename(struct inode *, struct dentry *,
58 struct inode *, struct dentry *); 58 struct inode *, struct dentry *);
59static int nfs_fsync_dir(struct file *, loff_t, loff_t, int); 59static int nfs_fsync_dir(struct file *, loff_t, loff_t, int);
@@ -112,7 +112,7 @@ const struct inode_operations nfs3_dir_inode_operations = {
112#ifdef CONFIG_NFS_V4 112#ifdef CONFIG_NFS_V4
113 113
114static struct dentry *nfs_atomic_lookup(struct inode *, struct dentry *, struct nameidata *); 114static struct dentry *nfs_atomic_lookup(struct inode *, struct dentry *, struct nameidata *);
115static int nfs_open_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd); 115static int nfs_open_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd);
116const struct inode_operations nfs4_dir_inode_operations = { 116const struct inode_operations nfs4_dir_inode_operations = {
117 .create = nfs_open_create, 117 .create = nfs_open_create,
118 .lookup = nfs_atomic_lookup, 118 .lookup = nfs_atomic_lookup,
@@ -1573,8 +1573,8 @@ no_open:
1573 return nfs_lookup_revalidate(dentry, nd); 1573 return nfs_lookup_revalidate(dentry, nd);
1574} 1574}
1575 1575
1576static int nfs_open_create(struct inode *dir, struct dentry *dentry, int mode, 1576static int nfs_open_create(struct inode *dir, struct dentry *dentry,
1577 struct nameidata *nd) 1577 umode_t mode, struct nameidata *nd)
1578{ 1578{
1579 struct nfs_open_context *ctx = NULL; 1579 struct nfs_open_context *ctx = NULL;
1580 struct iattr attr; 1580 struct iattr attr;
@@ -1664,8 +1664,8 @@ out_error:
1664 * that the operation succeeded on the server, but an error in the 1664 * that the operation succeeded on the server, but an error in the
1665 * reply path made it appear to have failed. 1665 * reply path made it appear to have failed.
1666 */ 1666 */
1667static int nfs_create(struct inode *dir, struct dentry *dentry, int mode, 1667static int nfs_create(struct inode *dir, struct dentry *dentry,
1668 struct nameidata *nd) 1668 umode_t mode, struct nameidata *nd)
1669{ 1669{
1670 struct iattr attr; 1670 struct iattr attr;
1671 int error; 1671 int error;
@@ -1693,7 +1693,7 @@ out_err:
1693 * See comments for nfs_proc_create regarding failed operations. 1693 * See comments for nfs_proc_create regarding failed operations.
1694 */ 1694 */
1695static int 1695static int
1696nfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) 1696nfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev)
1697{ 1697{
1698 struct iattr attr; 1698 struct iattr attr;
1699 int status; 1699 int status;
@@ -1719,7 +1719,7 @@ out_err:
1719/* 1719/*
1720 * See comments for nfs_proc_create regarding failed operations. 1720 * See comments for nfs_proc_create regarding failed operations.
1721 */ 1721 */
1722static int nfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 1722static int nfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
1723{ 1723{
1724 struct iattr attr; 1724 struct iattr attr;
1725 int error; 1725 int error;
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index c763de5c1157..68454e75fce9 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -59,7 +59,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
59 * the write call). 59 * the write call).
60 */ 60 */
61static inline __be32 61static inline __be32
62nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int requested) 62nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, umode_t requested)
63{ 63{
64 mode &= S_IFMT; 64 mode &= S_IFMT;
65 65
@@ -293,7 +293,7 @@ out:
293 * include/linux/nfsd/nfsd.h. 293 * include/linux/nfsd/nfsd.h.
294 */ 294 */
295__be32 295__be32
296fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) 296fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access)
297{ 297{
298 struct svc_export *exp; 298 struct svc_export *exp;
299 struct dentry *dentry; 299 struct dentry *dentry;
diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h
index c16f8d8331b5..e5e6707ba687 100644
--- a/fs/nfsd/nfsfh.h
+++ b/fs/nfsd/nfsfh.h
@@ -102,7 +102,7 @@ extern char * SVCFH_fmt(struct svc_fh *fhp);
102/* 102/*
103 * Function prototypes 103 * Function prototypes
104 */ 104 */
105__be32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int); 105__be32 fh_verify(struct svc_rqst *, struct svc_fh *, umode_t, int);
106__be32 fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *); 106__be32 fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *);
107__be32 fh_update(struct svc_fh *); 107__be32 fh_update(struct svc_fh *);
108void fh_put(struct svc_fh *); 108void fh_put(struct svc_fh *);
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 29b1202313e9..d25a723b68ad 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -307,7 +307,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
307 struct dentry *dentry; 307 struct dentry *dentry;
308 struct inode *inode; 308 struct inode *inode;
309 int accmode = NFSD_MAY_SATTR; 309 int accmode = NFSD_MAY_SATTR;
310 int ftype = 0; 310 umode_t ftype = 0;
311 __be32 err; 311 __be32 err;
312 int host_err; 312 int host_err;
313 int size_change = 0; 313 int size_change = 0;
@@ -730,7 +730,7 @@ static int nfsd_open_break_lease(struct inode *inode, int access)
730 * N.B. After this call fhp needs an fh_put 730 * N.B. After this call fhp needs an fh_put
731 */ 731 */
732__be32 732__be32
733nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, 733nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
734 int access, struct file **filp) 734 int access, struct file **filp)
735{ 735{
736 struct dentry *dentry; 736 struct dentry *dentry;
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h
index cee6a12296e8..1dcd238e11a0 100644
--- a/fs/nfsd/vfs.h
+++ b/fs/nfsd/vfs.h
@@ -66,7 +66,7 @@ __be32 do_nfsd_create(struct svc_rqst *, struct svc_fh *,
66__be32 nfsd_commit(struct svc_rqst *, struct svc_fh *, 66__be32 nfsd_commit(struct svc_rqst *, struct svc_fh *,
67 loff_t, unsigned long); 67 loff_t, unsigned long);
68#endif /* CONFIG_NFSD_V3 */ 68#endif /* CONFIG_NFSD_V3 */
69__be32 nfsd_open(struct svc_rqst *, struct svc_fh *, int, 69__be32 nfsd_open(struct svc_rqst *, struct svc_fh *, umode_t,
70 int, struct file **); 70 int, struct file **);
71void nfsd_close(struct file *); 71void nfsd_close(struct file *);
72__be32 nfsd_read(struct svc_rqst *, struct svc_fh *, 72__be32 nfsd_read(struct svc_rqst *, struct svc_fh *,
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
index 3a1923943b14..ca35b3a46d17 100644
--- a/fs/nilfs2/dir.c
+++ b/fs/nilfs2/dir.c
@@ -251,7 +251,7 @@ nilfs_type_by_mode[S_IFMT >> S_SHIFT] = {
251 251
252static void nilfs_set_de_type(struct nilfs_dir_entry *de, struct inode *inode) 252static void nilfs_set_de_type(struct nilfs_dir_entry *de, struct inode *inode)
253{ 253{
254 mode_t mode = inode->i_mode; 254 umode_t mode = inode->i_mode;
255 255
256 de->file_type = nilfs_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; 256 de->file_type = nilfs_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
257} 257}
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index b50ffb72e5b3..8f7b95ac1f7e 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -291,7 +291,7 @@ const struct address_space_operations nilfs_aops = {
291 .is_partially_uptodate = block_is_partially_uptodate, 291 .is_partially_uptodate = block_is_partially_uptodate,
292}; 292};
293 293
294struct inode *nilfs_new_inode(struct inode *dir, int mode) 294struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
295{ 295{
296 struct super_block *sb = dir->i_sb; 296 struct super_block *sb = dir->i_sb;
297 struct the_nilfs *nilfs = sb->s_fs_info; 297 struct the_nilfs *nilfs = sb->s_fs_info;
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c
index 768982de10e4..1cd3f624dffc 100644
--- a/fs/nilfs2/namei.c
+++ b/fs/nilfs2/namei.c
@@ -84,7 +84,7 @@ nilfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
84 * If the create succeeds, we fill in the inode information 84 * If the create succeeds, we fill in the inode information
85 * with d_instantiate(). 85 * with d_instantiate().
86 */ 86 */
87static int nilfs_create(struct inode *dir, struct dentry *dentry, int mode, 87static int nilfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
88 struct nameidata *nd) 88 struct nameidata *nd)
89{ 89{
90 struct inode *inode; 90 struct inode *inode;
@@ -112,7 +112,7 @@ static int nilfs_create(struct inode *dir, struct dentry *dentry, int mode,
112} 112}
113 113
114static int 114static int
115nilfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) 115nilfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev)
116{ 116{
117 struct inode *inode; 117 struct inode *inode;
118 struct nilfs_transaction_info ti; 118 struct nilfs_transaction_info ti;
@@ -213,7 +213,7 @@ static int nilfs_link(struct dentry *old_dentry, struct inode *dir,
213 return err; 213 return err;
214} 214}
215 215
216static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 216static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
217{ 217{
218 struct inode *inode; 218 struct inode *inode;
219 struct nilfs_transaction_info ti; 219 struct nilfs_transaction_info ti;
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h
index 3777d138f895..250add84da76 100644
--- a/fs/nilfs2/nilfs.h
+++ b/fs/nilfs2/nilfs.h
@@ -246,7 +246,7 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *, struct nilfs_argv *,
246/* inode.c */ 246/* inode.c */
247void nilfs_inode_add_blocks(struct inode *inode, int n); 247void nilfs_inode_add_blocks(struct inode *inode, int n);
248void nilfs_inode_sub_blocks(struct inode *inode, int n); 248void nilfs_inode_sub_blocks(struct inode *inode, int n);
249extern struct inode *nilfs_new_inode(struct inode *, int); 249extern struct inode *nilfs_new_inode(struct inode *, umode_t);
250extern void nilfs_free_inode(struct inode *); 250extern void nilfs_free_inode(struct inode *);
251extern int nilfs_get_block(struct inode *, sector_t, struct buffer_head *, int); 251extern int nilfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
252extern void nilfs_set_inode_flags(struct inode *); 252extern void nilfs_set_inode_flags(struct inode *);
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 9fde1c00a296..3568c8a8b138 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -16,6 +16,8 @@
16 16
17#include <asm/ioctls.h> 17#include <asm/ioctls.h>
18 18
19#include "../../mount.h"
20
19#define FANOTIFY_DEFAULT_MAX_EVENTS 16384 21#define FANOTIFY_DEFAULT_MAX_EVENTS 16384
20#define FANOTIFY_DEFAULT_MAX_MARKS 8192 22#define FANOTIFY_DEFAULT_MAX_MARKS 8192
21#define FANOTIFY_DEFAULT_MAX_LISTENERS 128 23#define FANOTIFY_DEFAULT_MAX_LISTENERS 128
@@ -546,7 +548,7 @@ static int fanotify_remove_vfsmount_mark(struct fsnotify_group *group,
546 548
547 removed = fanotify_mark_remove_from_mask(fsn_mark, mask, flags); 549 removed = fanotify_mark_remove_from_mask(fsn_mark, mask, flags);
548 fsnotify_put_mark(fsn_mark); 550 fsnotify_put_mark(fsn_mark);
549 if (removed & mnt->mnt_fsnotify_mask) 551 if (removed & real_mount(mnt)->mnt_fsnotify_mask)
550 fsnotify_recalc_vfsmount_mask(mnt); 552 fsnotify_recalc_vfsmount_mask(mnt);
551 553
552 return 0; 554 return 0;
@@ -623,7 +625,7 @@ static int fanotify_add_vfsmount_mark(struct fsnotify_group *group,
623 } 625 }
624 added = fanotify_mark_add_to_mask(fsn_mark, mask, flags); 626 added = fanotify_mark_add_to_mask(fsn_mark, mask, flags);
625 627
626 if (added & ~mnt->mnt_fsnotify_mask) 628 if (added & ~real_mount(mnt)->mnt_fsnotify_mask)
627 fsnotify_recalc_vfsmount_mask(mnt); 629 fsnotify_recalc_vfsmount_mask(mnt);
628err: 630err:
629 fsnotify_put_mark(fsn_mark); 631 fsnotify_put_mark(fsn_mark);
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index 79b47cbb5cd8..ccb14d3fc0de 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -26,6 +26,7 @@
26 26
27#include <linux/fsnotify_backend.h> 27#include <linux/fsnotify_backend.h>
28#include "fsnotify.h" 28#include "fsnotify.h"
29#include "../mount.h"
29 30
30/* 31/*
31 * Clear all of the marks on an inode when it is being evicted from core 32 * Clear all of the marks on an inode when it is being evicted from core
@@ -205,13 +206,13 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
205 struct fsnotify_mark *inode_mark = NULL, *vfsmount_mark = NULL; 206 struct fsnotify_mark *inode_mark = NULL, *vfsmount_mark = NULL;
206 struct fsnotify_group *inode_group, *vfsmount_group; 207 struct fsnotify_group *inode_group, *vfsmount_group;
207 struct fsnotify_event *event = NULL; 208 struct fsnotify_event *event = NULL;
208 struct vfsmount *mnt; 209 struct mount *mnt;
209 int idx, ret = 0; 210 int idx, ret = 0;
210 /* global tests shouldn't care about events on child only the specific event */ 211 /* global tests shouldn't care about events on child only the specific event */
211 __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD); 212 __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD);
212 213
213 if (data_is == FSNOTIFY_EVENT_PATH) 214 if (data_is == FSNOTIFY_EVENT_PATH)
214 mnt = ((struct path *)data)->mnt; 215 mnt = real_mount(((struct path *)data)->mnt);
215 else 216 else
216 mnt = NULL; 217 mnt = NULL;
217 218
@@ -262,11 +263,11 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
262 /* we didn't use the vfsmount_mark */ 263 /* we didn't use the vfsmount_mark */
263 vfsmount_group = NULL; 264 vfsmount_group = NULL;
264 } else if (vfsmount_group > inode_group) { 265 } else if (vfsmount_group > inode_group) {
265 ret = send_to_group(to_tell, mnt, NULL, vfsmount_mark, mask, data, 266 ret = send_to_group(to_tell, &mnt->mnt, NULL, vfsmount_mark, mask, data,
266 data_is, cookie, file_name, &event); 267 data_is, cookie, file_name, &event);
267 inode_group = NULL; 268 inode_group = NULL;
268 } else { 269 } else {
269 ret = send_to_group(to_tell, mnt, inode_mark, vfsmount_mark, 270 ret = send_to_group(to_tell, &mnt->mnt, inode_mark, vfsmount_mark,
270 mask, data, data_is, cookie, file_name, 271 mask, data, data_is, cookie, file_name,
271 &event); 272 &event);
272 } 273 }
diff --git a/fs/notify/vfsmount_mark.c b/fs/notify/vfsmount_mark.c
index 778fe6cae3b0..b7b4b0e8554f 100644
--- a/fs/notify/vfsmount_mark.c
+++ b/fs/notify/vfsmount_mark.c
@@ -28,15 +28,17 @@
28 28
29#include <linux/fsnotify_backend.h> 29#include <linux/fsnotify_backend.h>
30#include "fsnotify.h" 30#include "fsnotify.h"
31#include "../mount.h"
31 32
32void fsnotify_clear_marks_by_mount(struct vfsmount *mnt) 33void fsnotify_clear_marks_by_mount(struct vfsmount *mnt)
33{ 34{
34 struct fsnotify_mark *mark, *lmark; 35 struct fsnotify_mark *mark, *lmark;
35 struct hlist_node *pos, *n; 36 struct hlist_node *pos, *n;
37 struct mount *m = real_mount(mnt);
36 LIST_HEAD(free_list); 38 LIST_HEAD(free_list);
37 39
38 spin_lock(&mnt->mnt_root->d_lock); 40 spin_lock(&mnt->mnt_root->d_lock);
39 hlist_for_each_entry_safe(mark, pos, n, &mnt->mnt_fsnotify_marks, m.m_list) { 41 hlist_for_each_entry_safe(mark, pos, n, &m->mnt_fsnotify_marks, m.m_list) {
40 list_add(&mark->m.free_m_list, &free_list); 42 list_add(&mark->m.free_m_list, &free_list);
41 hlist_del_init_rcu(&mark->m.m_list); 43 hlist_del_init_rcu(&mark->m.m_list);
42 fsnotify_get_mark(mark); 44 fsnotify_get_mark(mark);
@@ -59,15 +61,16 @@ void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group)
59 */ 61 */
60static void fsnotify_recalc_vfsmount_mask_locked(struct vfsmount *mnt) 62static void fsnotify_recalc_vfsmount_mask_locked(struct vfsmount *mnt)
61{ 63{
64 struct mount *m = real_mount(mnt);
62 struct fsnotify_mark *mark; 65 struct fsnotify_mark *mark;
63 struct hlist_node *pos; 66 struct hlist_node *pos;
64 __u32 new_mask = 0; 67 __u32 new_mask = 0;
65 68
66 assert_spin_locked(&mnt->mnt_root->d_lock); 69 assert_spin_locked(&mnt->mnt_root->d_lock);
67 70
68 hlist_for_each_entry(mark, pos, &mnt->mnt_fsnotify_marks, m.m_list) 71 hlist_for_each_entry(mark, pos, &m->mnt_fsnotify_marks, m.m_list)
69 new_mask |= mark->mask; 72 new_mask |= mark->mask;
70 mnt->mnt_fsnotify_mask = new_mask; 73 m->mnt_fsnotify_mask = new_mask;
71} 74}
72 75
73/* 76/*
@@ -101,12 +104,13 @@ void fsnotify_destroy_vfsmount_mark(struct fsnotify_mark *mark)
101static struct fsnotify_mark *fsnotify_find_vfsmount_mark_locked(struct fsnotify_group *group, 104static struct fsnotify_mark *fsnotify_find_vfsmount_mark_locked(struct fsnotify_group *group,
102 struct vfsmount *mnt) 105 struct vfsmount *mnt)
103{ 106{
107 struct mount *m = real_mount(mnt);
104 struct fsnotify_mark *mark; 108 struct fsnotify_mark *mark;
105 struct hlist_node *pos; 109 struct hlist_node *pos;
106 110
107 assert_spin_locked(&mnt->mnt_root->d_lock); 111 assert_spin_locked(&mnt->mnt_root->d_lock);
108 112
109 hlist_for_each_entry(mark, pos, &mnt->mnt_fsnotify_marks, m.m_list) { 113 hlist_for_each_entry(mark, pos, &m->mnt_fsnotify_marks, m.m_list) {
110 if (mark->group == group) { 114 if (mark->group == group) {
111 fsnotify_get_mark(mark); 115 fsnotify_get_mark(mark);
112 return mark; 116 return mark;
@@ -140,6 +144,7 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
140 struct fsnotify_group *group, struct vfsmount *mnt, 144 struct fsnotify_group *group, struct vfsmount *mnt,
141 int allow_dups) 145 int allow_dups)
142{ 146{
147 struct mount *m = real_mount(mnt);
143 struct fsnotify_mark *lmark; 148 struct fsnotify_mark *lmark;
144 struct hlist_node *node, *last = NULL; 149 struct hlist_node *node, *last = NULL;
145 int ret = 0; 150 int ret = 0;
@@ -154,13 +159,13 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
154 mark->m.mnt = mnt; 159 mark->m.mnt = mnt;
155 160
156 /* is mark the first mark? */ 161 /* is mark the first mark? */
157 if (hlist_empty(&mnt->mnt_fsnotify_marks)) { 162 if (hlist_empty(&m->mnt_fsnotify_marks)) {
158 hlist_add_head_rcu(&mark->m.m_list, &mnt->mnt_fsnotify_marks); 163 hlist_add_head_rcu(&mark->m.m_list, &m->mnt_fsnotify_marks);
159 goto out; 164 goto out;
160 } 165 }
161 166
162 /* should mark be in the middle of the current list? */ 167 /* should mark be in the middle of the current list? */
163 hlist_for_each_entry(lmark, node, &mnt->mnt_fsnotify_marks, m.m_list) { 168 hlist_for_each_entry(lmark, node, &m->mnt_fsnotify_marks, m.m_list) {
164 last = node; 169 last = node;
165 170
166 if ((lmark->group == group) && !allow_dups) { 171 if ((lmark->group == group) && !allow_dups) {
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index b52706da4645..608be4516091 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -104,7 +104,7 @@ static bool parse_options(ntfs_volume *vol, char *opt)
104 int errors = 0, sloppy = 0; 104 int errors = 0, sloppy = 0;
105 uid_t uid = (uid_t)-1; 105 uid_t uid = (uid_t)-1;
106 gid_t gid = (gid_t)-1; 106 gid_t gid = (gid_t)-1;
107 mode_t fmask = (mode_t)-1, dmask = (mode_t)-1; 107 umode_t fmask = (umode_t)-1, dmask = (umode_t)-1;
108 int mft_zone_multiplier = -1, on_errors = -1; 108 int mft_zone_multiplier = -1, on_errors = -1;
109 int show_sys_files = -1, case_sensitive = -1, disable_sparse = -1; 109 int show_sys_files = -1, case_sensitive = -1, disable_sparse = -1;
110 struct nls_table *nls_map = NULL, *old_nls; 110 struct nls_table *nls_map = NULL, *old_nls;
@@ -287,9 +287,9 @@ no_mount_options:
287 vol->uid = uid; 287 vol->uid = uid;
288 if (gid != (gid_t)-1) 288 if (gid != (gid_t)-1)
289 vol->gid = gid; 289 vol->gid = gid;
290 if (fmask != (mode_t)-1) 290 if (fmask != (umode_t)-1)
291 vol->fmask = fmask; 291 vol->fmask = fmask;
292 if (dmask != (mode_t)-1) 292 if (dmask != (umode_t)-1)
293 vol->dmask = dmask; 293 vol->dmask = dmask;
294 if (show_sys_files != -1) { 294 if (show_sys_files != -1) {
295 if (show_sys_files) 295 if (show_sys_files)
diff --git a/fs/ntfs/volume.h b/fs/ntfs/volume.h
index 406ab55dfb32..15e3ba8d521a 100644
--- a/fs/ntfs/volume.h
+++ b/fs/ntfs/volume.h
@@ -48,8 +48,8 @@ typedef struct {
48 unsigned long flags; /* Miscellaneous flags, see below. */ 48 unsigned long flags; /* Miscellaneous flags, see below. */
49 uid_t uid; /* uid that files will be mounted as. */ 49 uid_t uid; /* uid that files will be mounted as. */
50 gid_t gid; /* gid that files will be mounted as. */ 50 gid_t gid; /* gid that files will be mounted as. */
51 mode_t fmask; /* The mask for file permissions. */ 51 umode_t fmask; /* The mask for file permissions. */
52 mode_t dmask; /* The mask for directory 52 umode_t dmask; /* The mask for directory
53 permissions. */ 53 permissions. */
54 u8 mft_zone_multiplier; /* Initial mft zone multiplier. */ 54 u8 mft_zone_multiplier; /* Initial mft zone multiplier. */
55 u8 on_errors; /* What to do on filesystem errors. */ 55 u8 on_errors; /* What to do on filesystem errors. */
diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c
index dc45deb19e68..73ba81928bce 100644
--- a/fs/ocfs2/cluster/netdebug.c
+++ b/fs/ocfs2/cluster/netdebug.c
@@ -553,7 +553,7 @@ void o2net_debugfs_exit(void)
553 553
554int o2net_debugfs_init(void) 554int o2net_debugfs_init(void)
555{ 555{
556 mode_t mode = S_IFREG|S_IRUSR; 556 umode_t mode = S_IFREG|S_IRUSR;
557 557
558 o2net_dentry = debugfs_create_dir(O2NET_DEBUG_DIR, NULL); 558 o2net_dentry = debugfs_create_dir(O2NET_DEBUG_DIR, NULL);
559 if (o2net_dentry) 559 if (o2net_dentry)
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index a9f007de1da8..abfac0d7ae9c 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -400,16 +400,14 @@ static struct backing_dev_info dlmfs_backing_dev_info = {
400static struct inode *dlmfs_get_root_inode(struct super_block *sb) 400static struct inode *dlmfs_get_root_inode(struct super_block *sb)
401{ 401{
402 struct inode *inode = new_inode(sb); 402 struct inode *inode = new_inode(sb);
403 int mode = S_IFDIR | 0755; 403 umode_t mode = S_IFDIR | 0755;
404 struct dlmfs_inode_private *ip; 404 struct dlmfs_inode_private *ip;
405 405
406 if (inode) { 406 if (inode) {
407 ip = DLMFS_I(inode); 407 ip = DLMFS_I(inode);
408 408
409 inode->i_ino = get_next_ino(); 409 inode->i_ino = get_next_ino();
410 inode->i_mode = mode; 410 inode_init_owner(inode, NULL, mode);
411 inode->i_uid = current_fsuid();
412 inode->i_gid = current_fsgid();
413 inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info; 411 inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info;
414 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 412 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
415 inc_nlink(inode); 413 inc_nlink(inode);
@@ -423,7 +421,7 @@ static struct inode *dlmfs_get_root_inode(struct super_block *sb)
423 421
424static struct inode *dlmfs_get_inode(struct inode *parent, 422static struct inode *dlmfs_get_inode(struct inode *parent,
425 struct dentry *dentry, 423 struct dentry *dentry,
426 int mode) 424 umode_t mode)
427{ 425{
428 struct super_block *sb = parent->i_sb; 426 struct super_block *sb = parent->i_sb;
429 struct inode * inode = new_inode(sb); 427 struct inode * inode = new_inode(sb);
@@ -433,9 +431,7 @@ static struct inode *dlmfs_get_inode(struct inode *parent,
433 return NULL; 431 return NULL;
434 432
435 inode->i_ino = get_next_ino(); 433 inode->i_ino = get_next_ino();
436 inode->i_mode = mode; 434 inode_init_owner(inode, parent, mode);
437 inode->i_uid = current_fsuid();
438 inode->i_gid = current_fsgid();
439 inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info; 435 inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info;
440 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 436 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
441 437
@@ -472,13 +468,6 @@ static struct inode *dlmfs_get_inode(struct inode *parent,
472 inc_nlink(inode); 468 inc_nlink(inode);
473 break; 469 break;
474 } 470 }
475
476 if (parent->i_mode & S_ISGID) {
477 inode->i_gid = parent->i_gid;
478 if (S_ISDIR(mode))
479 inode->i_mode |= S_ISGID;
480 }
481
482 return inode; 471 return inode;
483} 472}
484 473
@@ -488,7 +477,7 @@ static struct inode *dlmfs_get_inode(struct inode *parent,
488/* SMP-safe */ 477/* SMP-safe */
489static int dlmfs_mkdir(struct inode * dir, 478static int dlmfs_mkdir(struct inode * dir,
490 struct dentry * dentry, 479 struct dentry * dentry,
491 int mode) 480 umode_t mode)
492{ 481{
493 int status; 482 int status;
494 struct inode *inode = NULL; 483 struct inode *inode = NULL;
@@ -536,7 +525,7 @@ bail:
536 525
537static int dlmfs_create(struct inode *dir, 526static int dlmfs_create(struct inode *dir,
538 struct dentry *dentry, 527 struct dentry *dentry,
539 int mode, 528 umode_t mode,
540 struct nameidata *nd) 529 struct nameidata *nd)
541{ 530{
542 int status = 0; 531 int status = 0;
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index a8b2bfea574e..be244692550d 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -185,7 +185,7 @@ bail:
185 return ret; 185 return ret;
186} 186}
187 187
188static struct inode *ocfs2_get_init_inode(struct inode *dir, int mode) 188static struct inode *ocfs2_get_init_inode(struct inode *dir, umode_t mode)
189{ 189{
190 struct inode *inode; 190 struct inode *inode;
191 191
@@ -207,7 +207,7 @@ static struct inode *ocfs2_get_init_inode(struct inode *dir, int mode)
207 207
208static int ocfs2_mknod(struct inode *dir, 208static int ocfs2_mknod(struct inode *dir,
209 struct dentry *dentry, 209 struct dentry *dentry,
210 int mode, 210 umode_t mode,
211 dev_t dev) 211 dev_t dev)
212{ 212{
213 int status = 0; 213 int status = 0;
@@ -602,7 +602,7 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
602 602
603static int ocfs2_mkdir(struct inode *dir, 603static int ocfs2_mkdir(struct inode *dir,
604 struct dentry *dentry, 604 struct dentry *dentry,
605 int mode) 605 umode_t mode)
606{ 606{
607 int ret; 607 int ret;
608 608
@@ -617,7 +617,7 @@ static int ocfs2_mkdir(struct inode *dir,
617 617
618static int ocfs2_create(struct inode *dir, 618static int ocfs2_create(struct inode *dir,
619 struct dentry *dentry, 619 struct dentry *dentry,
620 int mode, 620 umode_t mode,
621 struct nameidata *nd) 621 struct nameidata *nd)
622{ 622{
623 int ret; 623 int ret;
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index aa9e8777b09a..0ba9ea1e7961 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -623,7 +623,7 @@ int ocfs2_calc_security_init(struct inode *dir,
623 623
624int ocfs2_calc_xattr_init(struct inode *dir, 624int ocfs2_calc_xattr_init(struct inode *dir,
625 struct buffer_head *dir_bh, 625 struct buffer_head *dir_bh,
626 int mode, 626 umode_t mode,
627 struct ocfs2_security_xattr_info *si, 627 struct ocfs2_security_xattr_info *si,
628 int *want_clusters, 628 int *want_clusters,
629 int *xattr_credits, 629 int *xattr_credits,
diff --git a/fs/ocfs2/xattr.h b/fs/ocfs2/xattr.h
index d63cfb72316b..e5c7f15465b4 100644
--- a/fs/ocfs2/xattr.h
+++ b/fs/ocfs2/xattr.h
@@ -68,7 +68,7 @@ int ocfs2_calc_security_init(struct inode *,
68 struct ocfs2_security_xattr_info *, 68 struct ocfs2_security_xattr_info *,
69 int *, int *, struct ocfs2_alloc_context **); 69 int *, int *, struct ocfs2_alloc_context **);
70int ocfs2_calc_xattr_init(struct inode *, struct buffer_head *, 70int ocfs2_calc_xattr_init(struct inode *, struct buffer_head *,
71 int, struct ocfs2_security_xattr_info *, 71 umode_t, struct ocfs2_security_xattr_info *,
72 int *, int *, int *); 72 int *, int *, int *);
73 73
74/* 74/*
diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c
index 98e544274390..f00576ec320f 100644
--- a/fs/omfs/dir.c
+++ b/fs/omfs/dir.c
@@ -255,7 +255,7 @@ static int omfs_remove(struct inode *dir, struct dentry *dentry)
255 return 0; 255 return 0;
256} 256}
257 257
258static int omfs_add_node(struct inode *dir, struct dentry *dentry, int mode) 258static int omfs_add_node(struct inode *dir, struct dentry *dentry, umode_t mode)
259{ 259{
260 int err; 260 int err;
261 struct inode *inode = omfs_new_inode(dir, mode); 261 struct inode *inode = omfs_new_inode(dir, mode);
@@ -279,12 +279,12 @@ out_free_inode:
279 return err; 279 return err;
280} 280}
281 281
282static int omfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 282static int omfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
283{ 283{
284 return omfs_add_node(dir, dentry, mode | S_IFDIR); 284 return omfs_add_node(dir, dentry, mode | S_IFDIR);
285} 285}
286 286
287static int omfs_create(struct inode *dir, struct dentry *dentry, int mode, 287static int omfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
288 struct nameidata *nd) 288 struct nameidata *nd)
289{ 289{
290 return omfs_add_node(dir, dentry, mode | S_IFREG); 290 return omfs_add_node(dir, dentry, mode | S_IFREG);
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index e043c4cb9a97..6065bb0ba207 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -28,7 +28,7 @@ struct buffer_head *omfs_bread(struct super_block *sb, sector_t block)
28 return sb_bread(sb, clus_to_blk(sbi, block)); 28 return sb_bread(sb, clus_to_blk(sbi, block));
29} 29}
30 30
31struct inode *omfs_new_inode(struct inode *dir, int mode) 31struct inode *omfs_new_inode(struct inode *dir, umode_t mode)
32{ 32{
33 struct inode *inode; 33 struct inode *inode;
34 u64 new_block; 34 u64 new_block;
diff --git a/fs/omfs/omfs.h b/fs/omfs/omfs.h
index 7d414fef501a..8941f12c6b01 100644
--- a/fs/omfs/omfs.h
+++ b/fs/omfs/omfs.h
@@ -60,7 +60,7 @@ extern int omfs_shrink_inode(struct inode *inode);
60/* inode.c */ 60/* inode.c */
61extern struct buffer_head *omfs_bread(struct super_block *sb, sector_t block); 61extern struct buffer_head *omfs_bread(struct super_block *sb, sector_t block);
62extern struct inode *omfs_iget(struct super_block *sb, ino_t inode); 62extern struct inode *omfs_iget(struct super_block *sb, ino_t inode);
63extern struct inode *omfs_new_inode(struct inode *dir, int mode); 63extern struct inode *omfs_new_inode(struct inode *dir, umode_t mode);
64extern int omfs_reserve_block(struct super_block *sb, sector_t block); 64extern int omfs_reserve_block(struct super_block *sb, sector_t block);
65extern int omfs_find_empty_block(struct super_block *sb, int mode, ino_t *ino); 65extern int omfs_find_empty_block(struct super_block *sb, int mode, ino_t *ino);
66extern int omfs_sync_inode(struct inode *inode); 66extern int omfs_sync_inode(struct inode *inode);
diff --git a/fs/open.c b/fs/open.c
index 4ef8d868a448..2659f596f4c5 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -468,7 +468,7 @@ out_unlock:
468 return error; 468 return error;
469} 469}
470 470
471SYSCALL_DEFINE2(fchmod, unsigned int, fd, mode_t, mode) 471SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode)
472{ 472{
473 struct file * file; 473 struct file * file;
474 int err = -EBADF; 474 int err = -EBADF;
@@ -482,7 +482,7 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd, mode_t, mode)
482 return err; 482 return err;
483} 483}
484 484
485SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, mode_t, mode) 485SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, umode_t, mode)
486{ 486{
487 struct path path; 487 struct path path;
488 int error; 488 int error;
@@ -495,7 +495,7 @@ SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, mode_t, mode)
495 return error; 495 return error;
496} 496}
497 497
498SYSCALL_DEFINE2(chmod, const char __user *, filename, mode_t, mode) 498SYSCALL_DEFINE2(chmod, const char __user *, filename, umode_t, mode)
499{ 499{
500 return sys_fchmodat(AT_FDCWD, filename, mode); 500 return sys_fchmodat(AT_FDCWD, filename, mode);
501} 501}
@@ -877,7 +877,7 @@ void fd_install(unsigned int fd, struct file *file)
877 877
878EXPORT_SYMBOL(fd_install); 878EXPORT_SYMBOL(fd_install);
879 879
880static inline int build_open_flags(int flags, int mode, struct open_flags *op) 880static inline int build_open_flags(int flags, umode_t mode, struct open_flags *op)
881{ 881{
882 int lookup_flags = 0; 882 int lookup_flags = 0;
883 int acc_mode; 883 int acc_mode;
@@ -948,7 +948,7 @@ static inline int build_open_flags(int flags, int mode, struct open_flags *op)
948 * have to. But in generally you should not do this, so please move 948 * have to. But in generally you should not do this, so please move
949 * along, nothing to see here.. 949 * along, nothing to see here..
950 */ 950 */
951struct file *filp_open(const char *filename, int flags, int mode) 951struct file *filp_open(const char *filename, int flags, umode_t mode)
952{ 952{
953 struct open_flags op; 953 struct open_flags op;
954 int lookup = build_open_flags(flags, mode, &op); 954 int lookup = build_open_flags(flags, mode, &op);
@@ -970,7 +970,7 @@ struct file *file_open_root(struct dentry *dentry, struct vfsmount *mnt,
970} 970}
971EXPORT_SYMBOL(file_open_root); 971EXPORT_SYMBOL(file_open_root);
972 972
973long do_sys_open(int dfd, const char __user *filename, int flags, int mode) 973long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
974{ 974{
975 struct open_flags op; 975 struct open_flags op;
976 int lookup = build_open_flags(flags, mode, &op); 976 int lookup = build_open_flags(flags, mode, &op);
@@ -994,7 +994,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
994 return fd; 994 return fd;
995} 995}
996 996
997SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode) 997SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, umode_t, mode)
998{ 998{
999 long ret; 999 long ret;
1000 1000
@@ -1008,7 +1008,7 @@ SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode)
1008} 1008}
1009 1009
1010SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags, 1010SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags,
1011 int, mode) 1011 umode_t, mode)
1012{ 1012{
1013 long ret; 1013 long ret;
1014 1014
@@ -1027,7 +1027,7 @@ SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags,
1027 * For backward compatibility? Maybe this should be moved 1027 * For backward compatibility? Maybe this should be moved
1028 * into arch/i386 instead? 1028 * into arch/i386 instead?
1029 */ 1029 */
1030SYSCALL_DEFINE2(creat, const char __user *, pathname, int, mode) 1030SYSCALL_DEFINE2(creat, const char __user *, pathname, umode_t, mode)
1031{ 1031{
1032 return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode); 1032 return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode);
1033} 1033}
diff --git a/fs/pnode.c b/fs/pnode.c
index 4d5a06ea57a2..ab5fa9e1a79a 100644
--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -13,30 +13,30 @@
13#include "pnode.h" 13#include "pnode.h"
14 14
15/* return the next shared peer mount of @p */ 15/* return the next shared peer mount of @p */
16static inline struct vfsmount *next_peer(struct vfsmount *p) 16static inline struct mount *next_peer(struct mount *p)
17{ 17{
18 return list_entry(p->mnt_share.next, struct vfsmount, mnt_share); 18 return list_entry(p->mnt_share.next, struct mount, mnt_share);
19} 19}
20 20
21static inline struct vfsmount *first_slave(struct vfsmount *p) 21static inline struct mount *first_slave(struct mount *p)
22{ 22{
23 return list_entry(p->mnt_slave_list.next, struct vfsmount, mnt_slave); 23 return list_entry(p->mnt_slave_list.next, struct mount, mnt_slave);
24} 24}
25 25
26static inline struct vfsmount *next_slave(struct vfsmount *p) 26static inline struct mount *next_slave(struct mount *p)
27{ 27{
28 return list_entry(p->mnt_slave.next, struct vfsmount, mnt_slave); 28 return list_entry(p->mnt_slave.next, struct mount, mnt_slave);
29} 29}
30 30
31static struct vfsmount *get_peer_under_root(struct vfsmount *mnt, 31static struct mount *get_peer_under_root(struct mount *mnt,
32 struct mnt_namespace *ns, 32 struct mnt_namespace *ns,
33 const struct path *root) 33 const struct path *root)
34{ 34{
35 struct vfsmount *m = mnt; 35 struct mount *m = mnt;
36 36
37 do { 37 do {
38 /* Check the namespace first for optimization */ 38 /* Check the namespace first for optimization */
39 if (m->mnt_ns == ns && is_path_reachable(m, m->mnt_root, root)) 39 if (m->mnt_ns == ns && is_path_reachable(m, m->mnt.mnt_root, root))
40 return m; 40 return m;
41 41
42 m = next_peer(m); 42 m = next_peer(m);
@@ -51,12 +51,12 @@ static struct vfsmount *get_peer_under_root(struct vfsmount *mnt,
51 * 51 *
52 * Caller must hold namespace_sem 52 * Caller must hold namespace_sem
53 */ 53 */
54int get_dominating_id(struct vfsmount *mnt, const struct path *root) 54int get_dominating_id(struct mount *mnt, const struct path *root)
55{ 55{
56 struct vfsmount *m; 56 struct mount *m;
57 57
58 for (m = mnt->mnt_master; m != NULL; m = m->mnt_master) { 58 for (m = mnt->mnt_master; m != NULL; m = m->mnt_master) {
59 struct vfsmount *d = get_peer_under_root(m, mnt->mnt_ns, root); 59 struct mount *d = get_peer_under_root(m, mnt->mnt_ns, root);
60 if (d) 60 if (d)
61 return d->mnt_group_id; 61 return d->mnt_group_id;
62 } 62 }
@@ -64,10 +64,10 @@ int get_dominating_id(struct vfsmount *mnt, const struct path *root)
64 return 0; 64 return 0;
65} 65}
66 66
67static int do_make_slave(struct vfsmount *mnt) 67static int do_make_slave(struct mount *mnt)
68{ 68{
69 struct vfsmount *peer_mnt = mnt, *master = mnt->mnt_master; 69 struct mount *peer_mnt = mnt, *master = mnt->mnt_master;
70 struct vfsmount *slave_mnt; 70 struct mount *slave_mnt;
71 71
72 /* 72 /*
73 * slave 'mnt' to a peer mount that has the 73 * slave 'mnt' to a peer mount that has the
@@ -75,7 +75,7 @@ static int do_make_slave(struct vfsmount *mnt)
75 * slave it to anything that is available. 75 * slave it to anything that is available.
76 */ 76 */
77 while ((peer_mnt = next_peer(peer_mnt)) != mnt && 77 while ((peer_mnt = next_peer(peer_mnt)) != mnt &&
78 peer_mnt->mnt_root != mnt->mnt_root) ; 78 peer_mnt->mnt.mnt_root != mnt->mnt.mnt_root) ;
79 79
80 if (peer_mnt == mnt) { 80 if (peer_mnt == mnt) {
81 peer_mnt = next_peer(mnt); 81 peer_mnt = next_peer(mnt);
@@ -101,7 +101,7 @@ static int do_make_slave(struct vfsmount *mnt)
101 struct list_head *p = &mnt->mnt_slave_list; 101 struct list_head *p = &mnt->mnt_slave_list;
102 while (!list_empty(p)) { 102 while (!list_empty(p)) {
103 slave_mnt = list_first_entry(p, 103 slave_mnt = list_first_entry(p,
104 struct vfsmount, mnt_slave); 104 struct mount, mnt_slave);
105 list_del_init(&slave_mnt->mnt_slave); 105 list_del_init(&slave_mnt->mnt_slave);
106 slave_mnt->mnt_master = NULL; 106 slave_mnt->mnt_master = NULL;
107 } 107 }
@@ -114,7 +114,7 @@ static int do_make_slave(struct vfsmount *mnt)
114/* 114/*
115 * vfsmount lock must be held for write 115 * vfsmount lock must be held for write
116 */ 116 */
117void change_mnt_propagation(struct vfsmount *mnt, int type) 117void change_mnt_propagation(struct mount *mnt, int type)
118{ 118{
119 if (type == MS_SHARED) { 119 if (type == MS_SHARED) {
120 set_mnt_shared(mnt); 120 set_mnt_shared(mnt);
@@ -125,9 +125,9 @@ void change_mnt_propagation(struct vfsmount *mnt, int type)
125 list_del_init(&mnt->mnt_slave); 125 list_del_init(&mnt->mnt_slave);
126 mnt->mnt_master = NULL; 126 mnt->mnt_master = NULL;
127 if (type == MS_UNBINDABLE) 127 if (type == MS_UNBINDABLE)
128 mnt->mnt_flags |= MNT_UNBINDABLE; 128 mnt->mnt.mnt_flags |= MNT_UNBINDABLE;
129 else 129 else
130 mnt->mnt_flags &= ~MNT_UNBINDABLE; 130 mnt->mnt.mnt_flags &= ~MNT_UNBINDABLE;
131 } 131 }
132} 132}
133 133
@@ -141,20 +141,19 @@ void change_mnt_propagation(struct vfsmount *mnt, int type)
141 * vfsmount found while iterating with propagation_next() is 141 * vfsmount found while iterating with propagation_next() is
142 * a peer of one we'd found earlier. 142 * a peer of one we'd found earlier.
143 */ 143 */
144static struct vfsmount *propagation_next(struct vfsmount *m, 144static struct mount *propagation_next(struct mount *m,
145 struct vfsmount *origin) 145 struct mount *origin)
146{ 146{
147 /* are there any slaves of this mount? */ 147 /* are there any slaves of this mount? */
148 if (!IS_MNT_NEW(m) && !list_empty(&m->mnt_slave_list)) 148 if (!IS_MNT_NEW(m) && !list_empty(&m->mnt_slave_list))
149 return first_slave(m); 149 return first_slave(m);
150 150
151 while (1) { 151 while (1) {
152 struct vfsmount *next; 152 struct mount *master = m->mnt_master;
153 struct vfsmount *master = m->mnt_master;
154 153
155 if (master == origin->mnt_master) { 154 if (master == origin->mnt_master) {
156 next = next_peer(m); 155 struct mount *next = next_peer(m);
157 return ((next == origin) ? NULL : next); 156 return (next == origin) ? NULL : next;
158 } else if (m->mnt_slave.next != &master->mnt_slave_list) 157 } else if (m->mnt_slave.next != &master->mnt_slave_list)
159 return next_slave(m); 158 return next_slave(m);
160 159
@@ -172,13 +171,13 @@ static struct vfsmount *propagation_next(struct vfsmount *m,
172 * @type return CL_SLAVE if the new mount has to be 171 * @type return CL_SLAVE if the new mount has to be
173 * cloned as a slave. 172 * cloned as a slave.
174 */ 173 */
175static struct vfsmount *get_source(struct vfsmount *dest, 174static struct mount *get_source(struct mount *dest,
176 struct vfsmount *last_dest, 175 struct mount *last_dest,
177 struct vfsmount *last_src, 176 struct mount *last_src,
178 int *type) 177 int *type)
179{ 178{
180 struct vfsmount *p_last_src = NULL; 179 struct mount *p_last_src = NULL;
181 struct vfsmount *p_last_dest = NULL; 180 struct mount *p_last_dest = NULL;
182 181
183 while (last_dest != dest->mnt_master) { 182 while (last_dest != dest->mnt_master) {
184 p_last_dest = last_dest; 183 p_last_dest = last_dest;
@@ -218,33 +217,33 @@ static struct vfsmount *get_source(struct vfsmount *dest,
218 * @source_mnt: source mount. 217 * @source_mnt: source mount.
219 * @tree_list : list of heads of trees to be attached. 218 * @tree_list : list of heads of trees to be attached.
220 */ 219 */
221int propagate_mnt(struct vfsmount *dest_mnt, struct dentry *dest_dentry, 220int propagate_mnt(struct mount *dest_mnt, struct dentry *dest_dentry,
222 struct vfsmount *source_mnt, struct list_head *tree_list) 221 struct mount *source_mnt, struct list_head *tree_list)
223{ 222{
224 struct vfsmount *m, *child; 223 struct mount *m, *child;
225 int ret = 0; 224 int ret = 0;
226 struct vfsmount *prev_dest_mnt = dest_mnt; 225 struct mount *prev_dest_mnt = dest_mnt;
227 struct vfsmount *prev_src_mnt = source_mnt; 226 struct mount *prev_src_mnt = source_mnt;
228 LIST_HEAD(tmp_list); 227 LIST_HEAD(tmp_list);
229 LIST_HEAD(umount_list); 228 LIST_HEAD(umount_list);
230 229
231 for (m = propagation_next(dest_mnt, dest_mnt); m; 230 for (m = propagation_next(dest_mnt, dest_mnt); m;
232 m = propagation_next(m, dest_mnt)) { 231 m = propagation_next(m, dest_mnt)) {
233 int type; 232 int type;
234 struct vfsmount *source; 233 struct mount *source;
235 234
236 if (IS_MNT_NEW(m)) 235 if (IS_MNT_NEW(m))
237 continue; 236 continue;
238 237
239 source = get_source(m, prev_dest_mnt, prev_src_mnt, &type); 238 source = get_source(m, prev_dest_mnt, prev_src_mnt, &type);
240 239
241 if (!(child = copy_tree(source, source->mnt_root, type))) { 240 if (!(child = copy_tree(source, source->mnt.mnt_root, type))) {
242 ret = -ENOMEM; 241 ret = -ENOMEM;
243 list_splice(tree_list, tmp_list.prev); 242 list_splice(tree_list, tmp_list.prev);
244 goto out; 243 goto out;
245 } 244 }
246 245
247 if (is_subdir(dest_dentry, m->mnt_root)) { 246 if (is_subdir(dest_dentry, m->mnt.mnt_root)) {
248 mnt_set_mountpoint(m, dest_dentry, child); 247 mnt_set_mountpoint(m, dest_dentry, child);
249 list_add_tail(&child->mnt_hash, tree_list); 248 list_add_tail(&child->mnt_hash, tree_list);
250 } else { 249 } else {
@@ -260,7 +259,7 @@ int propagate_mnt(struct vfsmount *dest_mnt, struct dentry *dest_dentry,
260out: 259out:
261 br_write_lock(vfsmount_lock); 260 br_write_lock(vfsmount_lock);
262 while (!list_empty(&tmp_list)) { 261 while (!list_empty(&tmp_list)) {
263 child = list_first_entry(&tmp_list, struct vfsmount, mnt_hash); 262 child = list_first_entry(&tmp_list, struct mount, mnt_hash);
264 umount_tree(child, 0, &umount_list); 263 umount_tree(child, 0, &umount_list);
265 } 264 }
266 br_write_unlock(vfsmount_lock); 265 br_write_unlock(vfsmount_lock);
@@ -271,7 +270,7 @@ out:
271/* 270/*
272 * return true if the refcount is greater than count 271 * return true if the refcount is greater than count
273 */ 272 */
274static inline int do_refcount_check(struct vfsmount *mnt, int count) 273static inline int do_refcount_check(struct mount *mnt, int count)
275{ 274{
276 int mycount = mnt_get_count(mnt) - mnt->mnt_ghosts; 275 int mycount = mnt_get_count(mnt) - mnt->mnt_ghosts;
277 return (mycount > count); 276 return (mycount > count);
@@ -287,10 +286,10 @@ static inline int do_refcount_check(struct vfsmount *mnt, int count)
287 * 286 *
288 * vfsmount lock must be held for write 287 * vfsmount lock must be held for write
289 */ 288 */
290int propagate_mount_busy(struct vfsmount *mnt, int refcnt) 289int propagate_mount_busy(struct mount *mnt, int refcnt)
291{ 290{
292 struct vfsmount *m, *child; 291 struct mount *m, *child;
293 struct vfsmount *parent = mnt->mnt_parent; 292 struct mount *parent = mnt->mnt_parent;
294 int ret = 0; 293 int ret = 0;
295 294
296 if (mnt == parent) 295 if (mnt == parent)
@@ -306,7 +305,7 @@ int propagate_mount_busy(struct vfsmount *mnt, int refcnt)
306 305
307 for (m = propagation_next(parent, parent); m; 306 for (m = propagation_next(parent, parent); m;
308 m = propagation_next(m, parent)) { 307 m = propagation_next(m, parent)) {
309 child = __lookup_mnt(m, mnt->mnt_mountpoint, 0); 308 child = __lookup_mnt(&m->mnt, mnt->mnt_mountpoint, 0);
310 if (child && list_empty(&child->mnt_mounts) && 309 if (child && list_empty(&child->mnt_mounts) &&
311 (ret = do_refcount_check(child, 1))) 310 (ret = do_refcount_check(child, 1)))
312 break; 311 break;
@@ -318,17 +317,17 @@ int propagate_mount_busy(struct vfsmount *mnt, int refcnt)
318 * NOTE: unmounting 'mnt' naturally propagates to all other mounts its 317 * NOTE: unmounting 'mnt' naturally propagates to all other mounts its
319 * parent propagates to. 318 * parent propagates to.
320 */ 319 */
321static void __propagate_umount(struct vfsmount *mnt) 320static void __propagate_umount(struct mount *mnt)
322{ 321{
323 struct vfsmount *parent = mnt->mnt_parent; 322 struct mount *parent = mnt->mnt_parent;
324 struct vfsmount *m; 323 struct mount *m;
325 324
326 BUG_ON(parent == mnt); 325 BUG_ON(parent == mnt);
327 326
328 for (m = propagation_next(parent, parent); m; 327 for (m = propagation_next(parent, parent); m;
329 m = propagation_next(m, parent)) { 328 m = propagation_next(m, parent)) {
330 329
331 struct vfsmount *child = __lookup_mnt(m, 330 struct mount *child = __lookup_mnt(&m->mnt,
332 mnt->mnt_mountpoint, 0); 331 mnt->mnt_mountpoint, 0);
333 /* 332 /*
334 * umount the child only if the child has no 333 * umount the child only if the child has no
@@ -348,7 +347,7 @@ static void __propagate_umount(struct vfsmount *mnt)
348 */ 347 */
349int propagate_umount(struct list_head *list) 348int propagate_umount(struct list_head *list)
350{ 349{
351 struct vfsmount *mnt; 350 struct mount *mnt;
352 351
353 list_for_each_entry(mnt, list, mnt_hash) 352 list_for_each_entry(mnt, list, mnt_hash)
354 __propagate_umount(mnt); 353 __propagate_umount(mnt);
diff --git a/fs/pnode.h b/fs/pnode.h
index 5c234e742193..65c60979d541 100644
--- a/fs/pnode.h
+++ b/fs/pnode.h
@@ -11,11 +11,11 @@
11#include <linux/list.h> 11#include <linux/list.h>
12#include "mount.h" 12#include "mount.h"
13 13
14#define IS_MNT_SHARED(mnt) ((mnt)->mnt_flags & MNT_SHARED) 14#define IS_MNT_SHARED(m) ((m)->mnt.mnt_flags & MNT_SHARED)
15#define IS_MNT_SLAVE(mnt) ((mnt)->mnt_master) 15#define IS_MNT_SLAVE(m) ((m)->mnt_master)
16#define IS_MNT_NEW(mnt) (!(mnt)->mnt_ns) 16#define IS_MNT_NEW(m) (!(m)->mnt_ns)
17#define CLEAR_MNT_SHARED(mnt) ((mnt)->mnt_flags &= ~MNT_SHARED) 17#define CLEAR_MNT_SHARED(m) ((m)->mnt.mnt_flags &= ~MNT_SHARED)
18#define IS_MNT_UNBINDABLE(mnt) ((mnt)->mnt_flags & MNT_UNBINDABLE) 18#define IS_MNT_UNBINDABLE(m) ((m)->mnt.mnt_flags & MNT_UNBINDABLE)
19 19
20#define CL_EXPIRE 0x01 20#define CL_EXPIRE 0x01
21#define CL_SLAVE 0x02 21#define CL_SLAVE 0x02
@@ -23,25 +23,25 @@
23#define CL_MAKE_SHARED 0x08 23#define CL_MAKE_SHARED 0x08
24#define CL_PRIVATE 0x10 24#define CL_PRIVATE 0x10
25 25
26static inline void set_mnt_shared(struct vfsmount *mnt) 26static inline void set_mnt_shared(struct mount *mnt)
27{ 27{
28 mnt->mnt_flags &= ~MNT_SHARED_MASK; 28 mnt->mnt.mnt_flags &= ~MNT_SHARED_MASK;
29 mnt->mnt_flags |= MNT_SHARED; 29 mnt->mnt.mnt_flags |= MNT_SHARED;
30} 30}
31 31
32void change_mnt_propagation(struct vfsmount *, int); 32void change_mnt_propagation(struct mount *, int);
33int propagate_mnt(struct vfsmount *, struct dentry *, struct vfsmount *, 33int propagate_mnt(struct mount *, struct dentry *, struct mount *,
34 struct list_head *); 34 struct list_head *);
35int propagate_umount(struct list_head *); 35int propagate_umount(struct list_head *);
36int propagate_mount_busy(struct vfsmount *, int); 36int propagate_mount_busy(struct mount *, int);
37void mnt_release_group_id(struct vfsmount *); 37void mnt_release_group_id(struct mount *);
38int get_dominating_id(struct vfsmount *mnt, const struct path *root); 38int get_dominating_id(struct mount *mnt, const struct path *root);
39unsigned int mnt_get_count(struct vfsmount *mnt); 39unsigned int mnt_get_count(struct mount *mnt);
40void mnt_set_mountpoint(struct vfsmount *, struct dentry *, 40void mnt_set_mountpoint(struct mount *, struct dentry *,
41 struct vfsmount *); 41 struct mount *);
42void release_mounts(struct list_head *); 42void release_mounts(struct list_head *);
43void umount_tree(struct vfsmount *, int, struct list_head *); 43void umount_tree(struct mount *, int, struct list_head *);
44struct vfsmount *copy_tree(struct vfsmount *, struct dentry *, int); 44struct mount *copy_tree(struct mount *, struct dentry *, int);
45bool is_path_reachable(struct vfsmount *, struct dentry *, 45bool is_path_reachable(struct mount *, struct dentry *,
46 const struct path *root); 46 const struct path *root);
47#endif /* _LINUX_PNODE_H */ 47#endif /* _LINUX_PNODE_H */
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 851ba3dcdc29..a1dddda999f2 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -101,7 +101,7 @@
101struct pid_entry { 101struct pid_entry {
102 char *name; 102 char *name;
103 int len; 103 int len;
104 mode_t mode; 104 umode_t mode;
105 const struct inode_operations *iop; 105 const struct inode_operations *iop;
106 const struct file_operations *fop; 106 const struct file_operations *fop;
107 union proc_op op; 107 union proc_op op;
@@ -631,120 +631,6 @@ static const struct inode_operations proc_def_inode_operations = {
631 .setattr = proc_setattr, 631 .setattr = proc_setattr,
632}; 632};
633 633
634static int mounts_open_common(struct inode *inode, struct file *file,
635 const struct seq_operations *op)
636{
637 struct task_struct *task = get_proc_task(inode);
638 struct nsproxy *nsp;
639 struct mnt_namespace *ns = NULL;
640 struct path root;
641 struct proc_mounts *p;
642 int ret = -EINVAL;
643
644 if (task) {
645 rcu_read_lock();
646 nsp = task_nsproxy(task);
647 if (nsp) {
648 ns = nsp->mnt_ns;
649 if (ns)
650 get_mnt_ns(ns);
651 }
652 rcu_read_unlock();
653 if (ns && get_task_root(task, &root) == 0)
654 ret = 0;
655 put_task_struct(task);
656 }
657
658 if (!ns)
659 goto err;
660 if (ret)
661 goto err_put_ns;
662
663 ret = -ENOMEM;
664 p = kmalloc(sizeof(struct proc_mounts), GFP_KERNEL);
665 if (!p)
666 goto err_put_path;
667
668 file->private_data = &p->m;
669 ret = seq_open(file, op);
670 if (ret)
671 goto err_free;
672
673 p->m.private = p;
674 p->ns = ns;
675 p->root = root;
676 p->m.poll_event = ns->event;
677
678 return 0;
679
680 err_free:
681 kfree(p);
682 err_put_path:
683 path_put(&root);
684 err_put_ns:
685 put_mnt_ns(ns);
686 err:
687 return ret;
688}
689
690static int mounts_release(struct inode *inode, struct file *file)
691{
692 struct proc_mounts *p = file->private_data;
693 path_put(&p->root);
694 put_mnt_ns(p->ns);
695 return seq_release(inode, file);
696}
697
698static unsigned mounts_poll(struct file *file, poll_table *wait)
699{
700 struct proc_mounts *p = file->private_data;
701 unsigned res = POLLIN | POLLRDNORM;
702
703 poll_wait(file, &p->ns->poll, wait);
704 if (mnt_had_events(p))
705 res |= POLLERR | POLLPRI;
706
707 return res;
708}
709
710static int mounts_open(struct inode *inode, struct file *file)
711{
712 return mounts_open_common(inode, file, &mounts_op);
713}
714
715static const struct file_operations proc_mounts_operations = {
716 .open = mounts_open,
717 .read = seq_read,
718 .llseek = seq_lseek,
719 .release = mounts_release,
720 .poll = mounts_poll,
721};
722
723static int mountinfo_open(struct inode *inode, struct file *file)
724{
725 return mounts_open_common(inode, file, &mountinfo_op);
726}
727
728static const struct file_operations proc_mountinfo_operations = {
729 .open = mountinfo_open,
730 .read = seq_read,
731 .llseek = seq_lseek,
732 .release = mounts_release,
733 .poll = mounts_poll,
734};
735
736static int mountstats_open(struct inode *inode, struct file *file)
737{
738 return mounts_open_common(inode, file, &mountstats_op);
739}
740
741static const struct file_operations proc_mountstats_operations = {
742 .open = mountstats_open,
743 .read = seq_read,
744 .llseek = seq_lseek,
745 .release = mounts_release,
746};
747
748#define PROC_BLOCK_SIZE (3*1024) /* 4K page size but our output routines use some slack for overruns */ 634#define PROC_BLOCK_SIZE (3*1024) /* 4K page size but our output routines use some slack for overruns */
749 635
750static ssize_t proc_info_read(struct file * file, char __user * buf, 636static ssize_t proc_info_read(struct file * file, char __user * buf,
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 10090d9c7ad5..2edf34f2eb61 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -597,7 +597,7 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp
597 597
598static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent, 598static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent,
599 const char *name, 599 const char *name,
600 mode_t mode, 600 umode_t mode,
601 nlink_t nlink) 601 nlink_t nlink)
602{ 602{
603 struct proc_dir_entry *ent = NULL; 603 struct proc_dir_entry *ent = NULL;
@@ -659,7 +659,7 @@ struct proc_dir_entry *proc_symlink(const char *name,
659} 659}
660EXPORT_SYMBOL(proc_symlink); 660EXPORT_SYMBOL(proc_symlink);
661 661
662struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode, 662struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
663 struct proc_dir_entry *parent) 663 struct proc_dir_entry *parent)
664{ 664{
665 struct proc_dir_entry *ent; 665 struct proc_dir_entry *ent;
@@ -699,7 +699,7 @@ struct proc_dir_entry *proc_mkdir(const char *name,
699} 699}
700EXPORT_SYMBOL(proc_mkdir); 700EXPORT_SYMBOL(proc_mkdir);
701 701
702struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, 702struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode,
703 struct proc_dir_entry *parent) 703 struct proc_dir_entry *parent)
704{ 704{
705 struct proc_dir_entry *ent; 705 struct proc_dir_entry *ent;
@@ -728,7 +728,7 @@ struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
728} 728}
729EXPORT_SYMBOL(create_proc_entry); 729EXPORT_SYMBOL(create_proc_entry);
730 730
731struct proc_dir_entry *proc_create_data(const char *name, mode_t mode, 731struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
732 struct proc_dir_entry *parent, 732 struct proc_dir_entry *parent,
733 const struct file_operations *proc_fops, 733 const struct file_operations *proc_fops,
734 void *data) 734 void *data)
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c
index be177f702acb..27da860115c6 100644
--- a/fs/proc/namespaces.c
+++ b/fs/proc/namespaces.c
@@ -9,7 +9,6 @@
9#include <linux/file.h> 9#include <linux/file.h>
10#include <linux/utsname.h> 10#include <linux/utsname.h>
11#include <net/net_namespace.h> 11#include <net/net_namespace.h>
12#include <linux/mnt_namespace.h>
13#include <linux/ipc_namespace.h> 12#include <linux/ipc_namespace.h>
14#include <linux/pid_namespace.h> 13#include <linux/pid_namespace.h>
15#include "internal.h" 14#include "internal.h"
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index f738024ccc8e..06e1cc17caf6 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -179,7 +179,7 @@ const struct file_operations proc_net_operations = {
179 179
180 180
181struct proc_dir_entry *proc_net_fops_create(struct net *net, 181struct proc_dir_entry *proc_net_fops_create(struct net *net,
182 const char *name, mode_t mode, const struct file_operations *fops) 182 const char *name, umode_t mode, const struct file_operations *fops)
183{ 183{
184 return proc_create(name, mode, net->proc_net, fops); 184 return proc_create(name, mode, net->proc_net, fops);
185} 185}
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
new file mode 100644
index 000000000000..9dcd9543ca12
--- /dev/null
+++ b/fs/proc_namespace.c
@@ -0,0 +1,331 @@
1/*
2 * fs/proc_namespace.c - handling of /proc/<pid>/{mounts,mountinfo,mountstats}
3 *
4 * In fact, that's a piece of procfs; it's *almost* isolated from
5 * the rest of fs/proc, but has rather close relationships with
6 * fs/namespace.c, thus here instead of fs/proc
7 *
8 */
9#include <linux/mnt_namespace.h>
10#include <linux/nsproxy.h>
11#include <linux/security.h>
12#include <linux/fs_struct.h>
13#include "proc/internal.h" /* only for get_proc_task() in ->open() */
14
15#include "pnode.h"
16#include "internal.h"
17
18static unsigned mounts_poll(struct file *file, poll_table *wait)
19{
20 struct proc_mounts *p = file->private_data;
21 struct mnt_namespace *ns = p->ns;
22 unsigned res = POLLIN | POLLRDNORM;
23
24 poll_wait(file, &p->ns->poll, wait);
25
26 br_read_lock(vfsmount_lock);
27 if (p->m.poll_event != ns->event) {
28 p->m.poll_event = ns->event;
29 res |= POLLERR | POLLPRI;
30 }
31 br_read_unlock(vfsmount_lock);
32
33 return res;
34}
35
36struct proc_fs_info {
37 int flag;
38 const char *str;
39};
40
41static int show_sb_opts(struct seq_file *m, struct super_block *sb)
42{
43 static const struct proc_fs_info fs_info[] = {
44 { MS_SYNCHRONOUS, ",sync" },
45 { MS_DIRSYNC, ",dirsync" },
46 { MS_MANDLOCK, ",mand" },
47 { 0, NULL }
48 };
49 const struct proc_fs_info *fs_infop;
50
51 for (fs_infop = fs_info; fs_infop->flag; fs_infop++) {
52 if (sb->s_flags & fs_infop->flag)
53 seq_puts(m, fs_infop->str);
54 }
55
56 return security_sb_show_options(m, sb);
57}
58
59static void show_mnt_opts(struct seq_file *m, struct vfsmount *mnt)
60{
61 static const struct proc_fs_info mnt_info[] = {
62 { MNT_NOSUID, ",nosuid" },
63 { MNT_NODEV, ",nodev" },
64 { MNT_NOEXEC, ",noexec" },
65 { MNT_NOATIME, ",noatime" },
66 { MNT_NODIRATIME, ",nodiratime" },
67 { MNT_RELATIME, ",relatime" },
68 { 0, NULL }
69 };
70 const struct proc_fs_info *fs_infop;
71
72 for (fs_infop = mnt_info; fs_infop->flag; fs_infop++) {
73 if (mnt->mnt_flags & fs_infop->flag)
74 seq_puts(m, fs_infop->str);
75 }
76}
77
78static inline void mangle(struct seq_file *m, const char *s)
79{
80 seq_escape(m, s, " \t\n\\");
81}
82
83static void show_type(struct seq_file *m, struct super_block *sb)
84{
85 mangle(m, sb->s_type->name);
86 if (sb->s_subtype && sb->s_subtype[0]) {
87 seq_putc(m, '.');
88 mangle(m, sb->s_subtype);
89 }
90}
91
92static int show_vfsmnt(struct seq_file *m, struct vfsmount *mnt)
93{
94 struct mount *r = real_mount(mnt);
95 int err = 0;
96 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
97
98 if (mnt->mnt_sb->s_op->show_devname) {
99 err = mnt->mnt_sb->s_op->show_devname(m, mnt);
100 if (err)
101 goto out;
102 } else {
103 mangle(m, r->mnt_devname ? r->mnt_devname : "none");
104 }
105 seq_putc(m, ' ');
106 seq_path(m, &mnt_path, " \t\n\\");
107 seq_putc(m, ' ');
108 show_type(m, mnt->mnt_sb);
109 seq_puts(m, __mnt_is_readonly(mnt) ? " ro" : " rw");
110 err = show_sb_opts(m, mnt->mnt_sb);
111 if (err)
112 goto out;
113 show_mnt_opts(m, mnt);
114 if (mnt->mnt_sb->s_op->show_options)
115 err = mnt->mnt_sb->s_op->show_options(m, mnt);
116 seq_puts(m, " 0 0\n");
117out:
118 return err;
119}
120
121static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
122{
123 struct proc_mounts *p = m->private;
124 struct mount *r = real_mount(mnt);
125 struct super_block *sb = mnt->mnt_sb;
126 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
127 struct path root = p->root;
128 int err = 0;
129
130 seq_printf(m, "%i %i %u:%u ", r->mnt_id, r->mnt_parent->mnt_id,
131 MAJOR(sb->s_dev), MINOR(sb->s_dev));
132 if (sb->s_op->show_path)
133 err = sb->s_op->show_path(m, mnt);
134 else
135 seq_dentry(m, mnt->mnt_root, " \t\n\\");
136 if (err)
137 goto out;
138 seq_putc(m, ' ');
139
140 /* mountpoints outside of chroot jail will give SEQ_SKIP on this */
141 err = seq_path_root(m, &mnt_path, &root, " \t\n\\");
142 if (err)
143 goto out;
144
145 seq_puts(m, mnt->mnt_flags & MNT_READONLY ? " ro" : " rw");
146 show_mnt_opts(m, mnt);
147
148 /* Tagged fields ("foo:X" or "bar") */
149 if (IS_MNT_SHARED(r))
150 seq_printf(m, " shared:%i", r->mnt_group_id);
151 if (IS_MNT_SLAVE(r)) {
152 int master = r->mnt_master->mnt_group_id;
153 int dom = get_dominating_id(r, &p->root);
154 seq_printf(m, " master:%i", master);
155 if (dom && dom != master)
156 seq_printf(m, " propagate_from:%i", dom);
157 }
158 if (IS_MNT_UNBINDABLE(r))
159 seq_puts(m, " unbindable");
160
161 /* Filesystem specific data */
162 seq_puts(m, " - ");
163 show_type(m, sb);
164 seq_putc(m, ' ');
165 if (sb->s_op->show_devname)
166 err = sb->s_op->show_devname(m, mnt);
167 else
168 mangle(m, r->mnt_devname ? r->mnt_devname : "none");
169 if (err)
170 goto out;
171 seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw");
172 err = show_sb_opts(m, sb);
173 if (err)
174 goto out;
175 if (sb->s_op->show_options)
176 err = sb->s_op->show_options(m, mnt);
177 seq_putc(m, '\n');
178out:
179 return err;
180}
181
182static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
183{
184 struct mount *r = real_mount(mnt);
185 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
186 int err = 0;
187
188 /* device */
189 if (mnt->mnt_sb->s_op->show_devname) {
190 seq_puts(m, "device ");
191 err = mnt->mnt_sb->s_op->show_devname(m, mnt);
192 } else {
193 if (r->mnt_devname) {
194 seq_puts(m, "device ");
195 mangle(m, r->mnt_devname);
196 } else
197 seq_puts(m, "no device");
198 }
199
200 /* mount point */
201 seq_puts(m, " mounted on ");
202 seq_path(m, &mnt_path, " \t\n\\");
203 seq_putc(m, ' ');
204
205 /* file system type */
206 seq_puts(m, "with fstype ");
207 show_type(m, mnt->mnt_sb);
208
209 /* optional statistics */
210 if (mnt->mnt_sb->s_op->show_stats) {
211 seq_putc(m, ' ');
212 if (!err)
213 err = mnt->mnt_sb->s_op->show_stats(m, mnt);
214 }
215
216 seq_putc(m, '\n');
217 return err;
218}
219
220static int mounts_open_common(struct inode *inode, struct file *file,
221 int (*show)(struct seq_file *, struct vfsmount *))
222{
223 struct task_struct *task = get_proc_task(inode);
224 struct nsproxy *nsp;
225 struct mnt_namespace *ns = NULL;
226 struct path root;
227 struct proc_mounts *p;
228 int ret = -EINVAL;
229
230 if (!task)
231 goto err;
232
233 rcu_read_lock();
234 nsp = task_nsproxy(task);
235 if (!nsp) {
236 rcu_read_unlock();
237 put_task_struct(task);
238 goto err;
239 }
240 ns = nsp->mnt_ns;
241 if (!ns) {
242 rcu_read_unlock();
243 put_task_struct(task);
244 goto err;
245 }
246 get_mnt_ns(ns);
247 rcu_read_unlock();
248 task_lock(task);
249 if (!task->fs) {
250 task_unlock(task);
251 put_task_struct(task);
252 ret = -ENOENT;
253 goto err_put_ns;
254 }
255 get_fs_root(task->fs, &root);
256 task_unlock(task);
257 put_task_struct(task);
258
259 ret = -ENOMEM;
260 p = kmalloc(sizeof(struct proc_mounts), GFP_KERNEL);
261 if (!p)
262 goto err_put_path;
263
264 file->private_data = &p->m;
265 ret = seq_open(file, &mounts_op);
266 if (ret)
267 goto err_free;
268
269 p->m.private = p;
270 p->ns = ns;
271 p->root = root;
272 p->m.poll_event = ns->event;
273 p->show = show;
274
275 return 0;
276
277 err_free:
278 kfree(p);
279 err_put_path:
280 path_put(&root);
281 err_put_ns:
282 put_mnt_ns(ns);
283 err:
284 return ret;
285}
286
287static int mounts_release(struct inode *inode, struct file *file)
288{
289 struct proc_mounts *p = file->private_data;
290 path_put(&p->root);
291 put_mnt_ns(p->ns);
292 return seq_release(inode, file);
293}
294
295static int mounts_open(struct inode *inode, struct file *file)
296{
297 return mounts_open_common(inode, file, show_vfsmnt);
298}
299
300static int mountinfo_open(struct inode *inode, struct file *file)
301{
302 return mounts_open_common(inode, file, show_mountinfo);
303}
304
305static int mountstats_open(struct inode *inode, struct file *file)
306{
307 return mounts_open_common(inode, file, show_vfsstat);
308}
309
310const struct file_operations proc_mounts_operations = {
311 .open = mounts_open,
312 .read = seq_read,
313 .llseek = seq_lseek,
314 .release = mounts_release,
315 .poll = mounts_poll,
316};
317
318const struct file_operations proc_mountinfo_operations = {
319 .open = mountinfo_open,
320 .read = seq_read,
321 .llseek = seq_lseek,
322 .release = mounts_release,
323 .poll = mounts_poll,
324};
325
326const struct file_operations proc_mountstats_operations = {
327 .open = mountstats_open,
328 .read = seq_read,
329 .llseek = seq_lseek,
330 .release = mounts_release,
331};
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index 462ceb38fec6..aec766abe3af 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -52,7 +52,7 @@ static struct backing_dev_info ramfs_backing_dev_info = {
52}; 52};
53 53
54struct inode *ramfs_get_inode(struct super_block *sb, 54struct inode *ramfs_get_inode(struct super_block *sb,
55 const struct inode *dir, int mode, dev_t dev) 55 const struct inode *dir, umode_t mode, dev_t dev)
56{ 56{
57 struct inode * inode = new_inode(sb); 57 struct inode * inode = new_inode(sb);
58 58
@@ -92,7 +92,7 @@ struct inode *ramfs_get_inode(struct super_block *sb,
92 */ 92 */
93/* SMP-safe */ 93/* SMP-safe */
94static int 94static int
95ramfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) 95ramfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
96{ 96{
97 struct inode * inode = ramfs_get_inode(dir->i_sb, dir, mode, dev); 97 struct inode * inode = ramfs_get_inode(dir->i_sb, dir, mode, dev);
98 int error = -ENOSPC; 98 int error = -ENOSPC;
@@ -106,7 +106,7 @@ ramfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
106 return error; 106 return error;
107} 107}
108 108
109static int ramfs_mkdir(struct inode * dir, struct dentry * dentry, int mode) 109static int ramfs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
110{ 110{
111 int retval = ramfs_mknod(dir, dentry, mode | S_IFDIR, 0); 111 int retval = ramfs_mknod(dir, dentry, mode | S_IFDIR, 0);
112 if (!retval) 112 if (!retval)
@@ -114,7 +114,7 @@ static int ramfs_mkdir(struct inode * dir, struct dentry * dentry, int mode)
114 return retval; 114 return retval;
115} 115}
116 116
117static int ramfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) 117static int ramfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd)
118{ 118{
119 return ramfs_mknod(dir, dentry, mode | S_IFREG, 0); 119 return ramfs_mknod(dir, dentry, mode | S_IFREG, 0);
120} 120}
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 950f13af0951..9e8cd5acd79c 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -1766,7 +1766,7 @@ static int reiserfs_new_symlink(struct reiserfs_transaction_handle *th, struct i
1766 for the fresh inode. This can only be done outside a transaction, so 1766 for the fresh inode. This can only be done outside a transaction, so
1767 if we return non-zero, we also end the transaction. */ 1767 if we return non-zero, we also end the transaction. */
1768int reiserfs_new_inode(struct reiserfs_transaction_handle *th, 1768int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1769 struct inode *dir, int mode, const char *symname, 1769 struct inode *dir, umode_t mode, const char *symname,
1770 /* 0 for regular, EMTRY_DIR_SIZE for dirs, 1770 /* 0 for regular, EMTRY_DIR_SIZE for dirs,
1771 strlen (symname) for symlinks) */ 1771 strlen (symname) for symlinks) */
1772 loff_t i_size, struct dentry *dentry, 1772 loff_t i_size, struct dentry *dentry,
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 80058e8ce361..146378865239 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -559,7 +559,7 @@ static int drop_new_inode(struct inode *inode)
559** outside of a transaction, so we had to pull some bits of 559** outside of a transaction, so we had to pull some bits of
560** reiserfs_new_inode out into this func. 560** reiserfs_new_inode out into this func.
561*/ 561*/
562static int new_inode_init(struct inode *inode, struct inode *dir, int mode) 562static int new_inode_init(struct inode *inode, struct inode *dir, umode_t mode)
563{ 563{
564 /* Make inode invalid - just in case we are going to drop it before 564 /* Make inode invalid - just in case we are going to drop it before
565 * the initialization happens */ 565 * the initialization happens */
@@ -572,7 +572,7 @@ static int new_inode_init(struct inode *inode, struct inode *dir, int mode)
572 return 0; 572 return 0;
573} 573}
574 574
575static int reiserfs_create(struct inode *dir, struct dentry *dentry, int mode, 575static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
576 struct nameidata *nd) 576 struct nameidata *nd)
577{ 577{
578 int retval; 578 int retval;
@@ -643,7 +643,7 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, int mode,
643 return retval; 643 return retval;
644} 644}
645 645
646static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode, 646static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
647 dev_t rdev) 647 dev_t rdev)
648{ 648{
649 int retval; 649 int retval;
@@ -721,7 +721,7 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
721 return retval; 721 return retval;
722} 722}
723 723
724static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 724static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
725{ 725{
726 int retval; 726 int retval;
727 struct inode *inode; 727 struct inode *inode;
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 6bc346c160e7..c24deda8a8bc 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -66,7 +66,7 @@ static int xattr_create(struct inode *dir, struct dentry *dentry, int mode)
66} 66}
67#endif 67#endif
68 68
69static int xattr_mkdir(struct inode *dir, struct dentry *dentry, int mode) 69static int xattr_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
70{ 70{
71 BUG_ON(!mutex_is_locked(&dir->i_mutex)); 71 BUG_ON(!mutex_is_locked(&dir->i_mutex));
72 return dir->i_op->mkdir(dir, dentry, mode); 72 return dir->i_op->mkdir(dir, dentry, mode);
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index d4e6080b4b20..62f4fb37789e 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -518,7 +518,7 @@ out:
518} 518}
519 519
520int sysfs_add_file_mode(struct sysfs_dirent *dir_sd, 520int sysfs_add_file_mode(struct sysfs_dirent *dir_sd,
521 const struct attribute *attr, int type, mode_t amode) 521 const struct attribute *attr, int type, umode_t amode)
522{ 522{
523 umode_t mode = (amode & S_IALLUGO) | S_IFREG; 523 umode_t mode = (amode & S_IALLUGO) | S_IFREG;
524 struct sysfs_addrm_cxt acxt; 524 struct sysfs_addrm_cxt acxt;
@@ -618,7 +618,7 @@ EXPORT_SYMBOL_GPL(sysfs_add_file_to_group);
618 * 618 *
619 */ 619 */
620int sysfs_chmod_file(struct kobject *kobj, const struct attribute *attr, 620int sysfs_chmod_file(struct kobject *kobj, const struct attribute *attr,
621 mode_t mode) 621 umode_t mode)
622{ 622{
623 struct sysfs_dirent *sd; 623 struct sysfs_dirent *sd;
624 struct iattr newattrs; 624 struct iattr newattrs;
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c
index 194414f8298c..dd1701caecc9 100644
--- a/fs/sysfs/group.c
+++ b/fs/sysfs/group.c
@@ -33,7 +33,7 @@ static int create_files(struct sysfs_dirent *dir_sd, struct kobject *kobj,
33 int error = 0, i; 33 int error = 0, i;
34 34
35 for (i = 0, attr = grp->attrs; *attr && !error; i++, attr++) { 35 for (i = 0, attr = grp->attrs; *attr && !error; i++, attr++) {
36 mode_t mode = 0; 36 umode_t mode = 0;
37 37
38 /* in update mode, we're changing the permissions or 38 /* in update mode, we're changing the permissions or
39 * visibility. Do this by first removing then 39 * visibility. Do this by first removing then
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index c81b22f3ace1..4a802b4a9056 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -187,7 +187,7 @@ out:
187 return error; 187 return error;
188} 188}
189 189
190static inline void set_default_inode_attr(struct inode * inode, mode_t mode) 190static inline void set_default_inode_attr(struct inode * inode, umode_t mode)
191{ 191{
192 inode->i_mode = mode; 192 inode->i_mode = mode;
193 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 193 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index ce29e28b766d..7484a36ee678 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -79,7 +79,7 @@ struct sysfs_dirent {
79 }; 79 };
80 80
81 unsigned int s_flags; 81 unsigned int s_flags;
82 unsigned short s_mode; 82 umode_t s_mode;
83 ino_t s_ino; 83 ino_t s_ino;
84 struct sysfs_inode_attrs *s_iattr; 84 struct sysfs_inode_attrs *s_iattr;
85}; 85};
@@ -229,7 +229,7 @@ int sysfs_add_file(struct sysfs_dirent *dir_sd,
229 const struct attribute *attr, int type); 229 const struct attribute *attr, int type);
230 230
231int sysfs_add_file_mode(struct sysfs_dirent *dir_sd, 231int sysfs_add_file_mode(struct sysfs_dirent *dir_sd,
232 const struct attribute *attr, int type, mode_t amode); 232 const struct attribute *attr, int type, umode_t amode);
233/* 233/*
234 * bin.c 234 * bin.c
235 */ 235 */
diff --git a/fs/sysv/ialloc.c b/fs/sysv/ialloc.c
index 0c96c98bd1db..8233b02eccae 100644
--- a/fs/sysv/ialloc.c
+++ b/fs/sysv/ialloc.c
@@ -132,7 +132,7 @@ void sysv_free_inode(struct inode * inode)
132 brelse(bh); 132 brelse(bh);
133} 133}
134 134
135struct inode * sysv_new_inode(const struct inode * dir, mode_t mode) 135struct inode * sysv_new_inode(const struct inode * dir, umode_t mode)
136{ 136{
137 struct super_block *sb = dir->i_sb; 137 struct super_block *sb = dir->i_sb;
138 struct sysv_sb_info *sbi = SYSV_SB(sb); 138 struct sysv_sb_info *sbi = SYSV_SB(sb);
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c
index e474fbcf8bde..b217797e621b 100644
--- a/fs/sysv/namei.c
+++ b/fs/sysv/namei.c
@@ -61,7 +61,7 @@ static struct dentry *sysv_lookup(struct inode * dir, struct dentry * dentry, st
61 return NULL; 61 return NULL;
62} 62}
63 63
64static int sysv_mknod(struct inode * dir, struct dentry * dentry, int mode, dev_t rdev) 64static int sysv_mknod(struct inode * dir, struct dentry * dentry, umode_t mode, dev_t rdev)
65{ 65{
66 struct inode * inode; 66 struct inode * inode;
67 int err; 67 int err;
@@ -80,7 +80,7 @@ static int sysv_mknod(struct inode * dir, struct dentry * dentry, int mode, dev_
80 return err; 80 return err;
81} 81}
82 82
83static int sysv_create(struct inode * dir, struct dentry * dentry, int mode, struct nameidata *nd) 83static int sysv_create(struct inode * dir, struct dentry * dentry, umode_t mode, struct nameidata *nd)
84{ 84{
85 return sysv_mknod(dir, dentry, mode, 0); 85 return sysv_mknod(dir, dentry, mode, 0);
86} 86}
@@ -131,7 +131,7 @@ static int sysv_link(struct dentry * old_dentry, struct inode * dir,
131 return add_nondir(dentry, inode); 131 return add_nondir(dentry, inode);
132} 132}
133 133
134static int sysv_mkdir(struct inode * dir, struct dentry *dentry, int mode) 134static int sysv_mkdir(struct inode * dir, struct dentry *dentry, umode_t mode)
135{ 135{
136 struct inode * inode; 136 struct inode * inode;
137 int err = -EMLINK; 137 int err = -EMLINK;
diff --git a/fs/sysv/sysv.h b/fs/sysv/sysv.h
index bb55cdb394bf..0e4b821c5691 100644
--- a/fs/sysv/sysv.h
+++ b/fs/sysv/sysv.h
@@ -125,7 +125,7 @@ static inline void dirty_sb(struct super_block *sb)
125/* ialloc.c */ 125/* ialloc.c */
126extern struct sysv_inode *sysv_raw_inode(struct super_block *, unsigned, 126extern struct sysv_inode *sysv_raw_inode(struct super_block *, unsigned,
127 struct buffer_head **); 127 struct buffer_head **);
128extern struct inode * sysv_new_inode(const struct inode *, mode_t); 128extern struct inode * sysv_new_inode(const struct inode *, umode_t);
129extern void sysv_free_inode(struct inode *); 129extern void sysv_free_inode(struct inode *);
130extern unsigned long sysv_count_free_inodes(struct super_block *); 130extern unsigned long sysv_count_free_inodes(struct super_block *);
131 131
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 683492043317..d6fe1c79f18b 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -56,7 +56,7 @@
56 * 56 *
57 * This function returns the inherited flags. 57 * This function returns the inherited flags.
58 */ 58 */
59static int inherit_flags(const struct inode *dir, int mode) 59static int inherit_flags(const struct inode *dir, umode_t mode)
60{ 60{
61 int flags; 61 int flags;
62 const struct ubifs_inode *ui = ubifs_inode(dir); 62 const struct ubifs_inode *ui = ubifs_inode(dir);
@@ -86,7 +86,7 @@ static int inherit_flags(const struct inode *dir, int mode)
86 * case of failure. 86 * case of failure.
87 */ 87 */
88struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir, 88struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir,
89 int mode) 89 umode_t mode)
90{ 90{
91 struct inode *inode; 91 struct inode *inode;
92 struct ubifs_inode *ui; 92 struct ubifs_inode *ui;
@@ -253,7 +253,7 @@ out:
253 return ERR_PTR(err); 253 return ERR_PTR(err);
254} 254}
255 255
256static int ubifs_create(struct inode *dir, struct dentry *dentry, int mode, 256static int ubifs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
257 struct nameidata *nd) 257 struct nameidata *nd)
258{ 258{
259 struct inode *inode; 259 struct inode *inode;
@@ -268,7 +268,7 @@ static int ubifs_create(struct inode *dir, struct dentry *dentry, int mode,
268 * parent directory inode. 268 * parent directory inode.
269 */ 269 */
270 270
271 dbg_gen("dent '%.*s', mode %#x in dir ino %lu", 271 dbg_gen("dent '%.*s', mode %#hx in dir ino %lu",
272 dentry->d_name.len, dentry->d_name.name, mode, dir->i_ino); 272 dentry->d_name.len, dentry->d_name.name, mode, dir->i_ino);
273 273
274 err = ubifs_budget_space(c, &req); 274 err = ubifs_budget_space(c, &req);
@@ -712,7 +712,7 @@ out_cancel:
712 return err; 712 return err;
713} 713}
714 714
715static int ubifs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 715static int ubifs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
716{ 716{
717 struct inode *inode; 717 struct inode *inode;
718 struct ubifs_inode *dir_ui = ubifs_inode(dir); 718 struct ubifs_inode *dir_ui = ubifs_inode(dir);
@@ -725,7 +725,7 @@ static int ubifs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
725 * directory inode. 725 * directory inode.
726 */ 726 */
727 727
728 dbg_gen("dent '%.*s', mode %#x in dir ino %lu", 728 dbg_gen("dent '%.*s', mode %#hx in dir ino %lu",
729 dentry->d_name.len, dentry->d_name.name, mode, dir->i_ino); 729 dentry->d_name.len, dentry->d_name.name, mode, dir->i_ino);
730 730
731 err = ubifs_budget_space(c, &req); 731 err = ubifs_budget_space(c, &req);
@@ -769,7 +769,7 @@ out_budg:
769} 769}
770 770
771static int ubifs_mknod(struct inode *dir, struct dentry *dentry, 771static int ubifs_mknod(struct inode *dir, struct dentry *dentry,
772 int mode, dev_t rdev) 772 umode_t mode, dev_t rdev)
773{ 773{
774 struct inode *inode; 774 struct inode *inode;
775 struct ubifs_inode *ui; 775 struct ubifs_inode *ui;
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 27f22551f805..12e94774aa88 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -1734,7 +1734,7 @@ int ubifs_setattr(struct dentry *dentry, struct iattr *attr);
1734 1734
1735/* dir.c */ 1735/* dir.c */
1736struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir, 1736struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir,
1737 int mode); 1737 umode_t mode);
1738int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry, 1738int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
1739 struct kstat *stat); 1739 struct kstat *stat);
1740 1740
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index 6fb7e0adcda0..05ab48195be9 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -46,7 +46,7 @@ void udf_free_inode(struct inode *inode)
46 udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1); 46 udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1);
47} 47}
48 48
49struct inode *udf_new_inode(struct inode *dir, int mode, int *err) 49struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err)
50{ 50{
51 struct super_block *sb = dir->i_sb; 51 struct super_block *sb = dir->i_sb;
52 struct udf_sb_info *sbi = UDF_SB(sb); 52 struct udf_sb_info *sbi = UDF_SB(sb);
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 4fd1d809738c..4598904be1bb 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -48,7 +48,7 @@ MODULE_LICENSE("GPL");
48 48
49#define EXTENT_MERGE_SIZE 5 49#define EXTENT_MERGE_SIZE 5
50 50
51static mode_t udf_convert_permissions(struct fileEntry *); 51static umode_t udf_convert_permissions(struct fileEntry *);
52static int udf_update_inode(struct inode *, int); 52static int udf_update_inode(struct inode *, int);
53static void udf_fill_inode(struct inode *, struct buffer_head *); 53static void udf_fill_inode(struct inode *, struct buffer_head *);
54static int udf_sync_inode(struct inode *inode); 54static int udf_sync_inode(struct inode *inode);
@@ -1452,9 +1452,9 @@ static int udf_alloc_i_data(struct inode *inode, size_t size)
1452 return 0; 1452 return 0;
1453} 1453}
1454 1454
1455static mode_t udf_convert_permissions(struct fileEntry *fe) 1455static umode_t udf_convert_permissions(struct fileEntry *fe)
1456{ 1456{
1457 mode_t mode; 1457 umode_t mode;
1458 uint32_t permissions; 1458 uint32_t permissions;
1459 uint32_t flags; 1459 uint32_t flags;
1460 1460
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 4639e137222f..08bf46edf9c4 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -552,7 +552,7 @@ static int udf_delete_entry(struct inode *inode, struct fileIdentDesc *fi,
552 return udf_write_fi(inode, cfi, fi, fibh, NULL, NULL); 552 return udf_write_fi(inode, cfi, fi, fibh, NULL, NULL);
553} 553}
554 554
555static int udf_create(struct inode *dir, struct dentry *dentry, int mode, 555static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode,
556 struct nameidata *nd) 556 struct nameidata *nd)
557{ 557{
558 struct udf_fileident_bh fibh; 558 struct udf_fileident_bh fibh;
@@ -596,7 +596,7 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode,
596 return 0; 596 return 0;
597} 597}
598 598
599static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode, 599static int udf_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
600 dev_t rdev) 600 dev_t rdev)
601{ 601{
602 struct inode *inode; 602 struct inode *inode;
@@ -640,7 +640,7 @@ out:
640 return err; 640 return err;
641} 641}
642 642
643static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode) 643static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
644{ 644{
645 struct inode *inode; 645 struct inode *inode;
646 struct udf_fileident_bh fibh; 646 struct udf_fileident_bh fibh;
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 7cbe669e1026..c94fc889a486 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -195,11 +195,11 @@ struct udf_options {
195 unsigned int fileset; 195 unsigned int fileset;
196 unsigned int rootdir; 196 unsigned int rootdir;
197 unsigned int flags; 197 unsigned int flags;
198 mode_t umask; 198 umode_t umask;
199 gid_t gid; 199 gid_t gid;
200 uid_t uid; 200 uid_t uid;
201 mode_t fmode; 201 umode_t fmode;
202 mode_t dmode; 202 umode_t dmode;
203 struct nls_table *nls_map; 203 struct nls_table *nls_map;
204}; 204};
205 205
@@ -279,11 +279,11 @@ static int udf_show_options(struct seq_file *seq, struct vfsmount *mnt)
279 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_SET)) 279 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_SET))
280 seq_printf(seq, ",gid=%u", sbi->s_gid); 280 seq_printf(seq, ",gid=%u", sbi->s_gid);
281 if (sbi->s_umask != 0) 281 if (sbi->s_umask != 0)
282 seq_printf(seq, ",umask=%o", sbi->s_umask); 282 seq_printf(seq, ",umask=%ho", sbi->s_umask);
283 if (sbi->s_fmode != UDF_INVALID_MODE) 283 if (sbi->s_fmode != UDF_INVALID_MODE)
284 seq_printf(seq, ",mode=%o", sbi->s_fmode); 284 seq_printf(seq, ",mode=%ho", sbi->s_fmode);
285 if (sbi->s_dmode != UDF_INVALID_MODE) 285 if (sbi->s_dmode != UDF_INVALID_MODE)
286 seq_printf(seq, ",dmode=%o", sbi->s_dmode); 286 seq_printf(seq, ",dmode=%ho", sbi->s_dmode);
287 if (UDF_QUERY_FLAG(sb, UDF_FLAG_SESSION_SET)) 287 if (UDF_QUERY_FLAG(sb, UDF_FLAG_SESSION_SET))
288 seq_printf(seq, ",session=%u", sbi->s_session); 288 seq_printf(seq, ",session=%u", sbi->s_session);
289 if (UDF_QUERY_FLAG(sb, UDF_FLAG_LASTBLOCK_SET)) 289 if (UDF_QUERY_FLAG(sb, UDF_FLAG_LASTBLOCK_SET))
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
index 5142a82e3276..42ad69ac9576 100644
--- a/fs/udf/udf_sb.h
+++ b/fs/udf/udf_sb.h
@@ -50,7 +50,7 @@
50#define UDF_SPARABLE_MAP15 0x1522U 50#define UDF_SPARABLE_MAP15 0x1522U
51#define UDF_METADATA_MAP25 0x2511U 51#define UDF_METADATA_MAP25 0x2511U
52 52
53#define UDF_INVALID_MODE ((mode_t)-1) 53#define UDF_INVALID_MODE ((umode_t)-1)
54 54
55#pragma pack(1) /* XXX(hch): Why? This file just defines in-core structures */ 55#pragma pack(1) /* XXX(hch): Why? This file just defines in-core structures */
56 56
@@ -127,11 +127,11 @@ struct udf_sb_info {
127 struct buffer_head *s_lvid_bh; 127 struct buffer_head *s_lvid_bh;
128 128
129 /* Default permissions */ 129 /* Default permissions */
130 mode_t s_umask; 130 umode_t s_umask;
131 gid_t s_gid; 131 gid_t s_gid;
132 uid_t s_uid; 132 uid_t s_uid;
133 mode_t s_fmode; 133 umode_t s_fmode;
134 mode_t s_dmode; 134 umode_t s_dmode;
135 /* Lock protecting consistency of above permission settings */ 135 /* Lock protecting consistency of above permission settings */
136 rwlock_t s_cred_lock; 136 rwlock_t s_cred_lock;
137 137
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index f34e6fc0cdaa..ebe10314e512 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -215,7 +215,7 @@ extern int udf_CS0toUTF8(struct ustr *, const struct ustr *);
215 215
216/* ialloc.c */ 216/* ialloc.c */
217extern void udf_free_inode(struct inode *); 217extern void udf_free_inode(struct inode *);
218extern struct inode *udf_new_inode(struct inode *, int, int *); 218extern struct inode *udf_new_inode(struct inode *, umode_t, int *);
219 219
220/* truncate.c */ 220/* truncate.c */
221extern void udf_truncate_tail_extent(struct inode *); 221extern void udf_truncate_tail_extent(struct inode *);
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index 78a4c70d46b5..4ec5c1085a87 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -170,7 +170,7 @@ static void ufs2_init_inodes_chunk(struct super_block *sb,
170 * For other inodes, search forward from the parent directory's block 170 * For other inodes, search forward from the parent directory's block
171 * group to find a free inode. 171 * group to find a free inode.
172 */ 172 */
173struct inode * ufs_new_inode(struct inode * dir, int mode) 173struct inode *ufs_new_inode(struct inode *dir, umode_t mode)
174{ 174{
175 struct super_block * sb; 175 struct super_block * sb;
176 struct ufs_sb_info * sbi; 176 struct ufs_sb_info * sbi;
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 879b13436fa4..9094e1d917be 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -583,7 +583,7 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode)
583{ 583{
584 struct ufs_inode_info *ufsi = UFS_I(inode); 584 struct ufs_inode_info *ufsi = UFS_I(inode);
585 struct super_block *sb = inode->i_sb; 585 struct super_block *sb = inode->i_sb;
586 mode_t mode; 586 umode_t mode;
587 587
588 /* 588 /*
589 * Copy data to the in-core inode. 589 * Copy data to the in-core inode.
@@ -630,7 +630,7 @@ static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode)
630{ 630{
631 struct ufs_inode_info *ufsi = UFS_I(inode); 631 struct ufs_inode_info *ufsi = UFS_I(inode);
632 struct super_block *sb = inode->i_sb; 632 struct super_block *sb = inode->i_sb;
633 mode_t mode; 633 umode_t mode;
634 634
635 UFSD("Reading ufs2 inode, ino %lu\n", inode->i_ino); 635 UFSD("Reading ufs2 inode, ino %lu\n", inode->i_ino);
636 /* 636 /*
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index 639d49162241..38cac199edff 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -70,7 +70,7 @@ static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, stru
70 * If the create succeeds, we fill in the inode information 70 * If the create succeeds, we fill in the inode information
71 * with d_instantiate(). 71 * with d_instantiate().
72 */ 72 */
73static int ufs_create (struct inode * dir, struct dentry * dentry, int mode, 73static int ufs_create (struct inode * dir, struct dentry * dentry, umode_t mode,
74 struct nameidata *nd) 74 struct nameidata *nd)
75{ 75{
76 struct inode *inode; 76 struct inode *inode;
@@ -94,7 +94,7 @@ static int ufs_create (struct inode * dir, struct dentry * dentry, int mode,
94 return err; 94 return err;
95} 95}
96 96
97static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t rdev) 97static int ufs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev)
98{ 98{
99 struct inode *inode; 99 struct inode *inode;
100 int err; 100 int err;
@@ -180,7 +180,7 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir,
180 return error; 180 return error;
181} 181}
182 182
183static int ufs_mkdir(struct inode * dir, struct dentry * dentry, int mode) 183static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
184{ 184{
185 struct inode * inode; 185 struct inode * inode;
186 int err = -EMLINK; 186 int err = -EMLINK;
diff --git a/fs/ufs/ufs.h b/fs/ufs/ufs.h
index c26f2bcec264..528750b7e701 100644
--- a/fs/ufs/ufs.h
+++ b/fs/ufs/ufs.h
@@ -104,7 +104,7 @@ extern const struct address_space_operations ufs_aops;
104 104
105/* ialloc.c */ 105/* ialloc.c */
106extern void ufs_free_inode (struct inode *inode); 106extern void ufs_free_inode (struct inode *inode);
107extern struct inode * ufs_new_inode (struct inode *, int); 107extern struct inode * ufs_new_inode (struct inode *, umode_t);
108 108
109/* inode.c */ 109/* inode.c */
110extern struct inode *ufs_iget(struct super_block *, unsigned long); 110extern struct inode *ufs_iget(struct super_block *, unsigned long);
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 169380e66057..dad1a31aa4fc 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -447,7 +447,7 @@ STATIC xfs_buf_t * /* allocation group buffer */
447xfs_ialloc_ag_select( 447xfs_ialloc_ag_select(
448 xfs_trans_t *tp, /* transaction pointer */ 448 xfs_trans_t *tp, /* transaction pointer */
449 xfs_ino_t parent, /* parent directory inode number */ 449 xfs_ino_t parent, /* parent directory inode number */
450 mode_t mode, /* bits set to indicate file type */ 450 umode_t mode, /* bits set to indicate file type */
451 int okalloc) /* ok to allocate more space */ 451 int okalloc) /* ok to allocate more space */
452{ 452{
453 xfs_buf_t *agbp; /* allocation group header buffer */ 453 xfs_buf_t *agbp; /* allocation group header buffer */
@@ -640,7 +640,7 @@ int
640xfs_dialloc( 640xfs_dialloc(
641 xfs_trans_t *tp, /* transaction pointer */ 641 xfs_trans_t *tp, /* transaction pointer */
642 xfs_ino_t parent, /* parent inode (directory) */ 642 xfs_ino_t parent, /* parent inode (directory) */
643 mode_t mode, /* mode bits for new inode */ 643 umode_t mode, /* mode bits for new inode */
644 int okalloc, /* ok to allocate more space */ 644 int okalloc, /* ok to allocate more space */
645 xfs_buf_t **IO_agbp, /* in/out ag header's buffer */ 645 xfs_buf_t **IO_agbp, /* in/out ag header's buffer */
646 boolean_t *alloc_done, /* true if we needed to replenish 646 boolean_t *alloc_done, /* true if we needed to replenish
diff --git a/fs/xfs/xfs_ialloc.h b/fs/xfs/xfs_ialloc.h
index bb5385475e1f..666a037398d6 100644
--- a/fs/xfs/xfs_ialloc.h
+++ b/fs/xfs/xfs_ialloc.h
@@ -81,7 +81,7 @@ int /* error */
81xfs_dialloc( 81xfs_dialloc(
82 struct xfs_trans *tp, /* transaction pointer */ 82 struct xfs_trans *tp, /* transaction pointer */
83 xfs_ino_t parent, /* parent inode (directory) */ 83 xfs_ino_t parent, /* parent inode (directory) */
84 mode_t mode, /* mode bits for new inode */ 84 umode_t mode, /* mode bits for new inode */
85 int okalloc, /* ok to allocate more space */ 85 int okalloc, /* ok to allocate more space */
86 struct xfs_buf **agbp, /* buf for a.g. inode header */ 86 struct xfs_buf **agbp, /* buf for a.g. inode header */
87 boolean_t *alloc_done, /* an allocation was done to replenish 87 boolean_t *alloc_done, /* an allocation was done to replenish
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 755ee8164880..9dda7cc32848 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -961,7 +961,7 @@ int
961xfs_ialloc( 961xfs_ialloc(
962 xfs_trans_t *tp, 962 xfs_trans_t *tp,
963 xfs_inode_t *pip, 963 xfs_inode_t *pip,
964 mode_t mode, 964 umode_t mode,
965 xfs_nlink_t nlink, 965 xfs_nlink_t nlink,
966 xfs_dev_t rdev, 966 xfs_dev_t rdev,
967 prid_t prid, 967 prid_t prid,
@@ -1002,7 +1002,7 @@ xfs_ialloc(
1002 return error; 1002 return error;
1003 ASSERT(ip != NULL); 1003 ASSERT(ip != NULL);
1004 1004
1005 ip->i_d.di_mode = (__uint16_t)mode; 1005 ip->i_d.di_mode = mode;
1006 ip->i_d.di_onlink = 0; 1006 ip->i_d.di_onlink = 0;
1007 ip->i_d.di_nlink = nlink; 1007 ip->i_d.di_nlink = nlink;
1008 ASSERT(ip->i_d.di_nlink == nlink); 1008 ASSERT(ip->i_d.di_nlink == nlink);
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index b4cd4739f98e..f0e6b151ba37 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -481,7 +481,7 @@ void xfs_inode_free(struct xfs_inode *ip);
481/* 481/*
482 * xfs_inode.c prototypes. 482 * xfs_inode.c prototypes.
483 */ 483 */
484int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, 484int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, umode_t,
485 xfs_nlink_t, xfs_dev_t, prid_t, int, 485 xfs_nlink_t, xfs_dev_t, prid_t, int,
486 struct xfs_buf **, boolean_t *, xfs_inode_t **); 486 struct xfs_buf **, boolean_t *, xfs_inode_t **);
487 487
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 23ce927973a4..f9babd179223 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -168,7 +168,7 @@ STATIC int
168xfs_vn_mknod( 168xfs_vn_mknod(
169 struct inode *dir, 169 struct inode *dir,
170 struct dentry *dentry, 170 struct dentry *dentry,
171 int mode, 171 umode_t mode,
172 dev_t rdev) 172 dev_t rdev)
173{ 173{
174 struct inode *inode; 174 struct inode *inode;
@@ -231,7 +231,7 @@ STATIC int
231xfs_vn_create( 231xfs_vn_create(
232 struct inode *dir, 232 struct inode *dir,
233 struct dentry *dentry, 233 struct dentry *dentry,
234 int mode, 234 umode_t mode,
235 struct nameidata *nd) 235 struct nameidata *nd)
236{ 236{
237 return xfs_vn_mknod(dir, dentry, mode, 0); 237 return xfs_vn_mknod(dir, dentry, mode, 0);
@@ -241,7 +241,7 @@ STATIC int
241xfs_vn_mkdir( 241xfs_vn_mkdir(
242 struct inode *dir, 242 struct inode *dir,
243 struct dentry *dentry, 243 struct dentry *dentry,
244 int mode) 244 umode_t mode)
245{ 245{
246 return xfs_vn_mknod(dir, dentry, mode|S_IFDIR, 0); 246 return xfs_vn_mknod(dir, dentry, mode|S_IFDIR, 0);
247} 247}
@@ -366,7 +366,7 @@ xfs_vn_symlink(
366 struct xfs_inode *cip = NULL; 366 struct xfs_inode *cip = NULL;
367 struct xfs_name name; 367 struct xfs_name name;
368 int error; 368 int error;
369 mode_t mode; 369 umode_t mode;
370 370
371 mode = S_IFLNK | 371 mode = S_IFLNK |
372 (irix_symlink_mode ? 0777 & ~current_umask() : S_IRWXUGO); 372 (irix_symlink_mode ? 0777 & ~current_umask() : S_IRWXUGO);
diff --git a/fs/xfs/xfs_utils.c b/fs/xfs/xfs_utils.c
index 8b32d1a4c5a1..89dbb4a50872 100644
--- a/fs/xfs/xfs_utils.c
+++ b/fs/xfs/xfs_utils.c
@@ -53,7 +53,7 @@ xfs_dir_ialloc(
53 output: may be a new transaction. */ 53 output: may be a new transaction. */
54 xfs_inode_t *dp, /* directory within whose allocate 54 xfs_inode_t *dp, /* directory within whose allocate
55 the inode. */ 55 the inode. */
56 mode_t mode, 56 umode_t mode,
57 xfs_nlink_t nlink, 57 xfs_nlink_t nlink,
58 xfs_dev_t rdev, 58 xfs_dev_t rdev,
59 prid_t prid, /* project id */ 59 prid_t prid, /* project id */
diff --git a/fs/xfs/xfs_utils.h b/fs/xfs/xfs_utils.h
index 456fca314933..5eeab4690cfe 100644
--- a/fs/xfs/xfs_utils.h
+++ b/fs/xfs/xfs_utils.h
@@ -18,7 +18,7 @@
18#ifndef __XFS_UTILS_H__ 18#ifndef __XFS_UTILS_H__
19#define __XFS_UTILS_H__ 19#define __XFS_UTILS_H__
20 20
21extern int xfs_dir_ialloc(xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t, 21extern int xfs_dir_ialloc(xfs_trans_t **, xfs_inode_t *, umode_t, xfs_nlink_t,
22 xfs_dev_t, prid_t, int, xfs_inode_t **, int *); 22 xfs_dev_t, prid_t, int, xfs_inode_t **, int *);
23extern int xfs_droplink(xfs_trans_t *, xfs_inode_t *); 23extern int xfs_droplink(xfs_trans_t *, xfs_inode_t *);
24extern int xfs_bumplink(xfs_trans_t *, xfs_inode_t *); 24extern int xfs_bumplink(xfs_trans_t *, xfs_inode_t *);
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index ce9268a2f56b..f2fea868d4db 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -822,7 +822,7 @@ int
822xfs_create( 822xfs_create(
823 xfs_inode_t *dp, 823 xfs_inode_t *dp,
824 struct xfs_name *name, 824 struct xfs_name *name,
825 mode_t mode, 825 umode_t mode,
826 xfs_dev_t rdev, 826 xfs_dev_t rdev,
827 xfs_inode_t **ipp) 827 xfs_inode_t **ipp)
828{ 828{
@@ -1481,7 +1481,7 @@ xfs_symlink(
1481 xfs_inode_t *dp, 1481 xfs_inode_t *dp,
1482 struct xfs_name *link_name, 1482 struct xfs_name *link_name,
1483 const char *target_path, 1483 const char *target_path,
1484 mode_t mode, 1484 umode_t mode,
1485 xfs_inode_t **ipp) 1485 xfs_inode_t **ipp)
1486{ 1486{
1487 xfs_mount_t *mp = dp->i_mount; 1487 xfs_mount_t *mp = dp->i_mount;
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h
index 35d3d513e1e9..0c877cbde142 100644
--- a/fs/xfs/xfs_vnodeops.h
+++ b/fs/xfs/xfs_vnodeops.h
@@ -26,7 +26,7 @@ int xfs_release(struct xfs_inode *ip);
26int xfs_inactive(struct xfs_inode *ip); 26int xfs_inactive(struct xfs_inode *ip);
27int xfs_lookup(struct xfs_inode *dp, struct xfs_name *name, 27int xfs_lookup(struct xfs_inode *dp, struct xfs_name *name,
28 struct xfs_inode **ipp, struct xfs_name *ci_name); 28 struct xfs_inode **ipp, struct xfs_name *ci_name);
29int xfs_create(struct xfs_inode *dp, struct xfs_name *name, mode_t mode, 29int xfs_create(struct xfs_inode *dp, struct xfs_name *name, umode_t mode,
30 xfs_dev_t rdev, struct xfs_inode **ipp); 30 xfs_dev_t rdev, struct xfs_inode **ipp);
31int xfs_remove(struct xfs_inode *dp, struct xfs_name *name, 31int xfs_remove(struct xfs_inode *dp, struct xfs_name *name,
32 struct xfs_inode *ip); 32 struct xfs_inode *ip);
@@ -35,7 +35,7 @@ int xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip,
35int xfs_readdir(struct xfs_inode *dp, void *dirent, size_t bufsize, 35int xfs_readdir(struct xfs_inode *dp, void *dirent, size_t bufsize,
36 xfs_off_t *offset, filldir_t filldir); 36 xfs_off_t *offset, filldir_t filldir);
37int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name, 37int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name,
38 const char *target_path, mode_t mode, struct xfs_inode **ipp); 38 const char *target_path, umode_t mode, struct xfs_inode **ipp);
39int xfs_set_dmattrs(struct xfs_inode *ip, u_int evmask, u_int16_t state); 39int xfs_set_dmattrs(struct xfs_inode *ip, u_int evmask, u_int16_t state);
40int xfs_change_file_space(struct xfs_inode *ip, int cmd, 40int xfs_change_file_space(struct xfs_inode *ip, int cmd,
41 xfs_flock64_t *bf, xfs_off_t offset, int attr_flags); 41 xfs_flock64_t *bf, xfs_off_t offset, int attr_flags);
diff --git a/include/asm-generic/types.h b/include/asm-generic/types.h
index 7a0f69e6c618..bd39806013b5 100644
--- a/include/asm-generic/types.h
+++ b/include/asm-generic/types.h
@@ -6,10 +6,4 @@
6 */ 6 */
7#include <asm-generic/int-ll64.h> 7#include <asm-generic/int-ll64.h>
8 8
9#ifndef __ASSEMBLY__
10
11typedef unsigned short umode_t;
12
13#endif /* __ASSEMBLY__ */
14
15#endif /* _ASM_GENERIC_TYPES_H */ 9#endif /* _ASM_GENERIC_TYPES_H */
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 2f81c6f3b630..426ab9f4dd85 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -468,13 +468,13 @@ extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
468#define audit_get_sessionid(t) ((t)->sessionid) 468#define audit_get_sessionid(t) ((t)->sessionid)
469extern void audit_log_task_context(struct audit_buffer *ab); 469extern void audit_log_task_context(struct audit_buffer *ab);
470extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); 470extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
471extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); 471extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode);
472extern int audit_bprm(struct linux_binprm *bprm); 472extern int audit_bprm(struct linux_binprm *bprm);
473extern void audit_socketcall(int nargs, unsigned long *args); 473extern void audit_socketcall(int nargs, unsigned long *args);
474extern int audit_sockaddr(int len, void *addr); 474extern int audit_sockaddr(int len, void *addr);
475extern void __audit_fd_pair(int fd1, int fd2); 475extern void __audit_fd_pair(int fd1, int fd2);
476extern int audit_set_macxattr(const char *name); 476extern int audit_set_macxattr(const char *name);
477extern void __audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr); 477extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr);
478extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout); 478extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout);
479extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification); 479extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification);
480extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat); 480extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
@@ -494,12 +494,12 @@ static inline void audit_fd_pair(int fd1, int fd2)
494 if (unlikely(!audit_dummy_context())) 494 if (unlikely(!audit_dummy_context()))
495 __audit_fd_pair(fd1, fd2); 495 __audit_fd_pair(fd1, fd2);
496} 496}
497static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode) 497static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode)
498{ 498{
499 if (unlikely(!audit_dummy_context())) 499 if (unlikely(!audit_dummy_context()))
500 __audit_ipc_set_perm(qbytes, uid, gid, mode); 500 __audit_ipc_set_perm(qbytes, uid, gid, mode);
501} 501}
502static inline void audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr) 502static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
503{ 503{
504 if (unlikely(!audit_dummy_context())) 504 if (unlikely(!audit_dummy_context()))
505 __audit_mq_open(oflag, mode, attr); 505 __audit_mq_open(oflag, mode, attr);
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 1b7f9d525013..a17becc36ca1 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -319,7 +319,7 @@ struct cftype {
319 * If not 0, file mode is set to this value, otherwise it will 319 * If not 0, file mode is set to this value, otherwise it will
320 * be figured out automatically 320 * be figured out automatically
321 */ 321 */
322 mode_t mode; 322 umode_t mode;
323 323
324 /* 324 /*
325 * If non-zero, defines the maximum length of string that can 325 * If non-zero, defines the maximum length of string that can
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 66ed067fb729..41c9f6515f46 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -422,9 +422,9 @@ asmlinkage long compat_sys_getdents64(unsigned int fd,
422asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *, 422asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
423 unsigned int nr_segs, unsigned int flags); 423 unsigned int nr_segs, unsigned int flags);
424asmlinkage long compat_sys_open(const char __user *filename, int flags, 424asmlinkage long compat_sys_open(const char __user *filename, int flags,
425 int mode); 425 umode_t mode);
426asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 426asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
427 int flags, int mode); 427 int flags, umode_t mode);
428asmlinkage long compat_sys_open_by_handle_at(int mountdirfd, 428asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
429 struct file_handle __user *handle, 429 struct file_handle __user *handle,
430 int flags); 430 int flags);
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 3081c58d696e..34025df61829 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -124,7 +124,7 @@ extern struct config_item *config_group_find_item(struct config_group *,
124struct configfs_attribute { 124struct configfs_attribute {
125 const char *ca_name; 125 const char *ca_name;
126 struct module *ca_owner; 126 struct module *ca_owner;
127 mode_t ca_mode; 127 umode_t ca_mode;
128}; 128};
129 129
130/* 130/*
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index e7d9b20ddc5b..d1ac841e8dc7 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -34,7 +34,7 @@ extern struct dentry *arch_debugfs_dir;
34extern const struct file_operations debugfs_file_operations; 34extern const struct file_operations debugfs_file_operations;
35extern const struct inode_operations debugfs_link_operations; 35extern const struct inode_operations debugfs_link_operations;
36 36
37struct dentry *debugfs_create_file(const char *name, mode_t mode, 37struct dentry *debugfs_create_file(const char *name, umode_t mode,
38 struct dentry *parent, void *data, 38 struct dentry *parent, void *data,
39 const struct file_operations *fops); 39 const struct file_operations *fops);
40 40
@@ -49,28 +49,28 @@ void debugfs_remove_recursive(struct dentry *dentry);
49struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, 49struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
50 struct dentry *new_dir, const char *new_name); 50 struct dentry *new_dir, const char *new_name);
51 51
52struct dentry *debugfs_create_u8(const char *name, mode_t mode, 52struct dentry *debugfs_create_u8(const char *name, umode_t mode,
53 struct dentry *parent, u8 *value); 53 struct dentry *parent, u8 *value);
54struct dentry *debugfs_create_u16(const char *name, mode_t mode, 54struct dentry *debugfs_create_u16(const char *name, umode_t mode,
55 struct dentry *parent, u16 *value); 55 struct dentry *parent, u16 *value);
56struct dentry *debugfs_create_u32(const char *name, mode_t mode, 56struct dentry *debugfs_create_u32(const char *name, umode_t mode,
57 struct dentry *parent, u32 *value); 57 struct dentry *parent, u32 *value);
58struct dentry *debugfs_create_u64(const char *name, mode_t mode, 58struct dentry *debugfs_create_u64(const char *name, umode_t mode,
59 struct dentry *parent, u64 *value); 59 struct dentry *parent, u64 *value);
60struct dentry *debugfs_create_x8(const char *name, mode_t mode, 60struct dentry *debugfs_create_x8(const char *name, umode_t mode,
61 struct dentry *parent, u8 *value); 61 struct dentry *parent, u8 *value);
62struct dentry *debugfs_create_x16(const char *name, mode_t mode, 62struct dentry *debugfs_create_x16(const char *name, umode_t mode,
63 struct dentry *parent, u16 *value); 63 struct dentry *parent, u16 *value);
64struct dentry *debugfs_create_x32(const char *name, mode_t mode, 64struct dentry *debugfs_create_x32(const char *name, umode_t mode,
65 struct dentry *parent, u32 *value); 65 struct dentry *parent, u32 *value);
66struct dentry *debugfs_create_x64(const char *name, mode_t mode, 66struct dentry *debugfs_create_x64(const char *name, umode_t mode,
67 struct dentry *parent, u64 *value); 67 struct dentry *parent, u64 *value);
68struct dentry *debugfs_create_size_t(const char *name, mode_t mode, 68struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
69 struct dentry *parent, size_t *value); 69 struct dentry *parent, size_t *value);
70struct dentry *debugfs_create_bool(const char *name, mode_t mode, 70struct dentry *debugfs_create_bool(const char *name, umode_t mode,
71 struct dentry *parent, u32 *value); 71 struct dentry *parent, u32 *value);
72 72
73struct dentry *debugfs_create_blob(const char *name, mode_t mode, 73struct dentry *debugfs_create_blob(const char *name, umode_t mode,
74 struct dentry *parent, 74 struct dentry *parent,
75 struct debugfs_blob_wrapper *blob); 75 struct debugfs_blob_wrapper *blob);
76 76
@@ -86,7 +86,7 @@ bool debugfs_initialized(void);
86 * want to duplicate the design decision mistakes of procfs and devfs again. 86 * want to duplicate the design decision mistakes of procfs and devfs again.
87 */ 87 */
88 88
89static inline struct dentry *debugfs_create_file(const char *name, mode_t mode, 89static inline struct dentry *debugfs_create_file(const char *name, umode_t mode,
90 struct dentry *parent, void *data, 90 struct dentry *parent, void *data,
91 const struct file_operations *fops) 91 const struct file_operations *fops)
92{ 92{
@@ -118,70 +118,70 @@ static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentr
118 return ERR_PTR(-ENODEV); 118 return ERR_PTR(-ENODEV);
119} 119}
120 120
121static inline struct dentry *debugfs_create_u8(const char *name, mode_t mode, 121static inline struct dentry *debugfs_create_u8(const char *name, umode_t mode,
122 struct dentry *parent, 122 struct dentry *parent,
123 u8 *value) 123 u8 *value)
124{ 124{
125 return ERR_PTR(-ENODEV); 125 return ERR_PTR(-ENODEV);
126} 126}
127 127
128static inline struct dentry *debugfs_create_u16(const char *name, mode_t mode, 128static inline struct dentry *debugfs_create_u16(const char *name, umode_t mode,
129 struct dentry *parent, 129 struct dentry *parent,
130 u16 *value) 130 u16 *value)
131{ 131{
132 return ERR_PTR(-ENODEV); 132 return ERR_PTR(-ENODEV);
133} 133}
134 134
135static inline struct dentry *debugfs_create_u32(const char *name, mode_t mode, 135static inline struct dentry *debugfs_create_u32(const char *name, umode_t mode,
136 struct dentry *parent, 136 struct dentry *parent,
137 u32 *value) 137 u32 *value)
138{ 138{
139 return ERR_PTR(-ENODEV); 139 return ERR_PTR(-ENODEV);
140} 140}
141 141
142static inline struct dentry *debugfs_create_u64(const char *name, mode_t mode, 142static inline struct dentry *debugfs_create_u64(const char *name, umode_t mode,
143 struct dentry *parent, 143 struct dentry *parent,
144 u64 *value) 144 u64 *value)
145{ 145{
146 return ERR_PTR(-ENODEV); 146 return ERR_PTR(-ENODEV);
147} 147}
148 148
149static inline struct dentry *debugfs_create_x8(const char *name, mode_t mode, 149static inline struct dentry *debugfs_create_x8(const char *name, umode_t mode,
150 struct dentry *parent, 150 struct dentry *parent,
151 u8 *value) 151 u8 *value)
152{ 152{
153 return ERR_PTR(-ENODEV); 153 return ERR_PTR(-ENODEV);
154} 154}
155 155
156static inline struct dentry *debugfs_create_x16(const char *name, mode_t mode, 156static inline struct dentry *debugfs_create_x16(const char *name, umode_t mode,
157 struct dentry *parent, 157 struct dentry *parent,
158 u16 *value) 158 u16 *value)
159{ 159{
160 return ERR_PTR(-ENODEV); 160 return ERR_PTR(-ENODEV);
161} 161}
162 162
163static inline struct dentry *debugfs_create_x32(const char *name, mode_t mode, 163static inline struct dentry *debugfs_create_x32(const char *name, umode_t mode,
164 struct dentry *parent, 164 struct dentry *parent,
165 u32 *value) 165 u32 *value)
166{ 166{
167 return ERR_PTR(-ENODEV); 167 return ERR_PTR(-ENODEV);
168} 168}
169 169
170static inline struct dentry *debugfs_create_size_t(const char *name, mode_t mode, 170static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
171 struct dentry *parent, 171 struct dentry *parent,
172 size_t *value) 172 size_t *value)
173{ 173{
174 return ERR_PTR(-ENODEV); 174 return ERR_PTR(-ENODEV);
175} 175}
176 176
177static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode, 177static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode,
178 struct dentry *parent, 178 struct dentry *parent,
179 u32 *value) 179 u32 *value)
180{ 180{
181 return ERR_PTR(-ENODEV); 181 return ERR_PTR(-ENODEV);
182} 182}
183 183
184static inline struct dentry *debugfs_create_blob(const char *name, mode_t mode, 184static inline struct dentry *debugfs_create_blob(const char *name, umode_t mode,
185 struct dentry *parent, 185 struct dentry *parent,
186 struct debugfs_blob_wrapper *blob) 186 struct debugfs_blob_wrapper *blob)
187{ 187{
diff --git a/include/linux/device.h b/include/linux/device.h
index 3136ede5a1e1..2fe0005543ed 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -294,7 +294,7 @@ struct class {
294 struct kobject *dev_kobj; 294 struct kobject *dev_kobj;
295 295
296 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 296 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
297 char *(*devnode)(struct device *dev, mode_t *mode); 297 char *(*devnode)(struct device *dev, umode_t *mode);
298 298
299 void (*class_release)(struct class *class); 299 void (*class_release)(struct class *class);
300 void (*dev_release)(struct device *dev); 300 void (*dev_release)(struct device *dev);
@@ -423,7 +423,7 @@ struct device_type {
423 const char *name; 423 const char *name;
424 const struct attribute_group **groups; 424 const struct attribute_group **groups;
425 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 425 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
426 char *(*devnode)(struct device *dev, mode_t *mode); 426 char *(*devnode)(struct device *dev, umode_t *mode);
427 void (*release)(struct device *dev); 427 void (*release)(struct device *dev);
428 428
429 const struct dev_pm_ops *pm; 429 const struct dev_pm_ops *pm;
@@ -720,7 +720,7 @@ extern int device_rename(struct device *dev, const char *new_name);
720extern int device_move(struct device *dev, struct device *new_parent, 720extern int device_move(struct device *dev, struct device *new_parent,
721 enum dpm_order dpm_order); 721 enum dpm_order dpm_order);
722extern const char *device_get_devnode(struct device *dev, 722extern const char *device_get_devnode(struct device *dev,
723 mode_t *mode, const char **tmp); 723 umode_t *mode, const char **tmp);
724extern void *dev_get_drvdata(const struct device *dev); 724extern void *dev_get_drvdata(const struct device *dev);
725extern int dev_set_drvdata(struct device *dev, void *data); 725extern int dev_set_drvdata(struct device *dev, void *data);
726 726
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index dec99116a0e4..f957085d40ed 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -884,7 +884,7 @@ extern int ext3fs_dirhash(const char *name, int len, struct
884 884
885/* ialloc.c */ 885/* ialloc.c */
886extern struct inode * ext3_new_inode (handle_t *, struct inode *, 886extern struct inode * ext3_new_inode (handle_t *, struct inode *,
887 const struct qstr *, int); 887 const struct qstr *, umode_t);
888extern void ext3_free_inode (handle_t *, struct inode *); 888extern void ext3_free_inode (handle_t *, struct inode *);
889extern struct inode * ext3_orphan_get (struct super_block *, unsigned long); 889extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
890extern unsigned long ext3_count_free_inodes (struct super_block *); 890extern unsigned long ext3_count_free_inodes (struct super_block *);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e853ba5eddd4..659be7d82617 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1516,9 +1516,9 @@ extern void unlock_super(struct super_block *);
1516/* 1516/*
1517 * VFS helper functions.. 1517 * VFS helper functions..
1518 */ 1518 */
1519extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); 1519extern int vfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *);
1520extern int vfs_mkdir(struct inode *, struct dentry *, int); 1520extern int vfs_mkdir(struct inode *, struct dentry *, umode_t);
1521extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); 1521extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
1522extern int vfs_symlink(struct inode *, struct dentry *, const char *); 1522extern int vfs_symlink(struct inode *, struct dentry *, const char *);
1523extern int vfs_link(struct dentry *, struct inode *, struct dentry *); 1523extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1524extern int vfs_rmdir(struct inode *, struct dentry *); 1524extern int vfs_rmdir(struct inode *, struct dentry *);
@@ -1534,7 +1534,7 @@ extern void dentry_unhash(struct dentry *dentry);
1534 * VFS file helper functions. 1534 * VFS file helper functions.
1535 */ 1535 */
1536extern void inode_init_owner(struct inode *inode, const struct inode *dir, 1536extern void inode_init_owner(struct inode *inode, const struct inode *dir,
1537 mode_t mode); 1537 umode_t mode);
1538/* 1538/*
1539 * VFS FS_IOC_FIEMAP helper definitions. 1539 * VFS FS_IOC_FIEMAP helper definitions.
1540 */ 1540 */
@@ -1619,13 +1619,13 @@ struct inode_operations {
1619 int (*readlink) (struct dentry *, char __user *,int); 1619 int (*readlink) (struct dentry *, char __user *,int);
1620 void (*put_link) (struct dentry *, struct nameidata *, void *); 1620 void (*put_link) (struct dentry *, struct nameidata *, void *);
1621 1621
1622 int (*create) (struct inode *,struct dentry *,int, struct nameidata *); 1622 int (*create) (struct inode *,struct dentry *,umode_t,struct nameidata *);
1623 int (*link) (struct dentry *,struct inode *,struct dentry *); 1623 int (*link) (struct dentry *,struct inode *,struct dentry *);
1624 int (*unlink) (struct inode *,struct dentry *); 1624 int (*unlink) (struct inode *,struct dentry *);
1625 int (*symlink) (struct inode *,struct dentry *,const char *); 1625 int (*symlink) (struct inode *,struct dentry *,const char *);
1626 int (*mkdir) (struct inode *,struct dentry *,int); 1626 int (*mkdir) (struct inode *,struct dentry *,umode_t);
1627 int (*rmdir) (struct inode *,struct dentry *); 1627 int (*rmdir) (struct inode *,struct dentry *);
1628 int (*mknod) (struct inode *,struct dentry *,int,dev_t); 1628 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
1629 int (*rename) (struct inode *, struct dentry *, 1629 int (*rename) (struct inode *, struct dentry *,
1630 struct inode *, struct dentry *); 1630 struct inode *, struct dentry *);
1631 void (*truncate) (struct inode *); 1631 void (*truncate) (struct inode *);
@@ -2054,8 +2054,8 @@ extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
2054extern int do_fallocate(struct file *file, int mode, loff_t offset, 2054extern int do_fallocate(struct file *file, int mode, loff_t offset,
2055 loff_t len); 2055 loff_t len);
2056extern long do_sys_open(int dfd, const char __user *filename, int flags, 2056extern long do_sys_open(int dfd, const char __user *filename, int flags,
2057 int mode); 2057 umode_t mode);
2058extern struct file *filp_open(const char *, int, int); 2058extern struct file *filp_open(const char *, int, umode_t);
2059extern struct file *file_open_root(struct dentry *, struct vfsmount *, 2059extern struct file *file_open_root(struct dentry *, struct vfsmount *,
2060 const char *, int); 2060 const char *, int);
2061extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, 2061extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
@@ -2693,7 +2693,7 @@ int __init get_filesystem_list(char *buf);
2693#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ 2693#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
2694 (flag & __FMODE_NONOTIFY))) 2694 (flag & __FMODE_NONOTIFY)))
2695 2695
2696static inline int is_sxid(mode_t mode) 2696static inline int is_sxid(umode_t mode)
2697{ 2697{
2698 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); 2698 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP));
2699} 2699}
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 6d18f3531f18..fe23ee768589 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -163,7 +163,7 @@ struct gendisk {
163 * disks that can't be partitioned. */ 163 * disks that can't be partitioned. */
164 164
165 char disk_name[DISK_NAME_LEN]; /* name of major driver */ 165 char disk_name[DISK_NAME_LEN]; /* name of major driver */
166 char *(*devnode)(struct gendisk *gd, mode_t *mode); 166 char *(*devnode)(struct gendisk *gd, umode_t *mode);
167 167
168 unsigned int events; /* supported events */ 168 unsigned int events; /* supported events */
169 unsigned int async_events; /* async events, subset of all */ 169 unsigned int async_events; /* async events, subset of all */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 42557851b12e..501370b61ee5 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -920,7 +920,7 @@ __IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL)
920 920
921typedef struct { 921typedef struct {
922 const char *name; 922 const char *name;
923 mode_t mode; 923 umode_t mode;
924 const struct file_operations *proc_fops; 924 const struct file_operations *proc_fops;
925} ide_proc_entry_t; 925} ide_proc_entry_t;
926 926
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 3b1594d662b0..30e816148df4 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -93,7 +93,7 @@ struct kern_ipc_perm
93 gid_t gid; 93 gid_t gid;
94 uid_t cuid; 94 uid_t cuid;
95 gid_t cgid; 95 gid_t cgid;
96 mode_t mode; 96 umode_t mode;
97 unsigned long seq; 97 unsigned long seq;
98 void *security; 98 void *security;
99}; 99};
diff --git a/include/linux/iscsi_boot_sysfs.h b/include/linux/iscsi_boot_sysfs.h
index f0a2f8b0aa13..2a8b1659bf35 100644
--- a/include/linux/iscsi_boot_sysfs.h
+++ b/include/linux/iscsi_boot_sysfs.h
@@ -91,7 +91,7 @@ struct iscsi_boot_kobj {
91 * The enum of the type. This can be any value of the above 91 * The enum of the type. This can be any value of the above
92 * properties. 92 * properties.
93 */ 93 */
94 mode_t (*is_visible) (void *data, int type); 94 umode_t (*is_visible) (void *data, int type);
95 95
96 /* 96 /*
97 * Driver specific release function. 97 * Driver specific release function.
@@ -110,20 +110,20 @@ struct iscsi_boot_kobj *
110iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index, 110iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index,
111 void *data, 111 void *data,
112 ssize_t (*show) (void *data, int type, char *buf), 112 ssize_t (*show) (void *data, int type, char *buf),
113 mode_t (*is_visible) (void *data, int type), 113 umode_t (*is_visible) (void *data, int type),
114 void (*release) (void *data)); 114 void (*release) (void *data));
115 115
116struct iscsi_boot_kobj * 116struct iscsi_boot_kobj *
117iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index, 117iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index,
118 void *data, 118 void *data,
119 ssize_t (*show) (void *data, int type, char *buf), 119 ssize_t (*show) (void *data, int type, char *buf),
120 mode_t (*is_visible) (void *data, int type), 120 umode_t (*is_visible) (void *data, int type),
121 void (*release) (void *data)); 121 void (*release) (void *data));
122struct iscsi_boot_kobj * 122struct iscsi_boot_kobj *
123iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index, 123iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index,
124 void *data, 124 void *data,
125 ssize_t (*show) (void *data, int type, char *buf), 125 ssize_t (*show) (void *data, int type, char *buf),
126 mode_t (*is_visible) (void *data, int type), 126 umode_t (*is_visible) (void *data, int type),
127 void (*release) (void *data)); 127 void (*release) (void *data));
128 128
129struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name); 129struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name);
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index c41d7270c6c6..32085249e9cb 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -54,7 +54,7 @@ struct miscdevice {
54 struct device *parent; 54 struct device *parent;
55 struct device *this_device; 55 struct device *this_device;
56 const char *nodename; 56 const char *nodename;
57 mode_t mode; 57 umode_t mode;
58}; 58};
59 59
60extern int misc_register(struct miscdevice * misc); 60extern int misc_register(struct miscdevice * misc);
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index e87ec01aac9d..5a8e3903d770 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -2,38 +2,16 @@
2#define _NAMESPACE_H_ 2#define _NAMESPACE_H_
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/path.h> 5struct mnt_namespace;
6#include <linux/seq_file.h>
7#include <linux/wait.h>
8
9struct mnt_namespace {
10 atomic_t count;
11 struct vfsmount * root;
12 struct list_head list;
13 wait_queue_head_t poll;
14 int event;
15};
16
17struct proc_mounts {
18 struct seq_file m; /* must be the first element */
19 struct mnt_namespace *ns;
20 struct path root;
21};
22
23struct fs_struct; 6struct fs_struct;
24 7
25extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, 8extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
26 struct fs_struct *); 9 struct fs_struct *);
27extern void put_mnt_ns(struct mnt_namespace *ns); 10extern void put_mnt_ns(struct mnt_namespace *ns);
28static inline void get_mnt_ns(struct mnt_namespace *ns)
29{
30 atomic_inc(&ns->count);
31}
32 11
33extern const struct seq_operations mounts_op; 12extern const struct file_operations proc_mounts_operations;
34extern const struct seq_operations mountinfo_op; 13extern const struct file_operations proc_mountinfo_operations;
35extern const struct seq_operations mountstats_op; 14extern const struct file_operations proc_mountstats_operations;
36extern int mnt_had_events(struct proc_mounts *);
37 15
38#endif 16#endif
39#endif 17#endif
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 00f5c4f2160b..d7029f4a191a 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -47,45 +47,10 @@ struct mnt_namespace;
47 47
48#define MNT_INTERNAL 0x4000 48#define MNT_INTERNAL 0x4000
49 49
50struct mnt_pcp {
51 int mnt_count;
52 int mnt_writers;
53};
54
55struct vfsmount { 50struct vfsmount {
56 struct list_head mnt_hash;
57 struct vfsmount *mnt_parent; /* fs we are mounted on */
58 struct dentry *mnt_mountpoint; /* dentry of mountpoint */
59 struct dentry *mnt_root; /* root of the mounted tree */ 51 struct dentry *mnt_root; /* root of the mounted tree */
60 struct super_block *mnt_sb; /* pointer to superblock */ 52 struct super_block *mnt_sb; /* pointer to superblock */
61#ifdef CONFIG_SMP
62 struct mnt_pcp __percpu *mnt_pcp;
63 atomic_t mnt_longterm; /* how many of the refs are longterm */
64#else
65 int mnt_count;
66 int mnt_writers;
67#endif
68 struct list_head mnt_mounts; /* list of children, anchored here */
69 struct list_head mnt_child; /* and going through their mnt_child */
70 int mnt_flags; 53 int mnt_flags;
71 /* 4 bytes hole on 64bits arches without fsnotify */
72#ifdef CONFIG_FSNOTIFY
73 __u32 mnt_fsnotify_mask;
74 struct hlist_head mnt_fsnotify_marks;
75#endif
76 const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
77 struct list_head mnt_list;
78 struct list_head mnt_expire; /* link in fs-specific expiry list */
79 struct list_head mnt_share; /* circular list of shared mounts */
80 struct list_head mnt_slave_list;/* list of slave mounts */
81 struct list_head mnt_slave; /* slave list entry */
82 struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */
83 struct mnt_namespace *mnt_ns; /* containing namespace */
84 int mnt_id; /* mount identifier */
85 int mnt_group_id; /* peer group identifier */
86 int mnt_expiry_mark; /* true if marked for expiry */
87 int mnt_pinned;
88 int mnt_ghosts;
89}; 54};
90 55
91struct file; /* forward dec */ 56struct file; /* forward dec */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 643b96c7a94f..6d9e575519cc 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -50,7 +50,7 @@ typedef int (write_proc_t)(struct file *file, const char __user *buffer,
50 50
51struct proc_dir_entry { 51struct proc_dir_entry {
52 unsigned int low_ino; 52 unsigned int low_ino;
53 mode_t mode; 53 umode_t mode;
54 nlink_t nlink; 54 nlink_t nlink;
55 uid_t uid; 55 uid_t uid;
56 gid_t gid; 56 gid_t gid;
@@ -106,9 +106,9 @@ extern void proc_root_init(void);
106 106
107void proc_flush_task(struct task_struct *task); 107void proc_flush_task(struct task_struct *task);
108 108
109extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, 109extern struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode,
110 struct proc_dir_entry *parent); 110 struct proc_dir_entry *parent);
111struct proc_dir_entry *proc_create_data(const char *name, mode_t mode, 111struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
112 struct proc_dir_entry *parent, 112 struct proc_dir_entry *parent,
113 const struct file_operations *proc_fops, 113 const struct file_operations *proc_fops,
114 void *data); 114 void *data);
@@ -146,17 +146,17 @@ extern void proc_device_tree_update_prop(struct proc_dir_entry *pde,
146extern struct proc_dir_entry *proc_symlink(const char *, 146extern struct proc_dir_entry *proc_symlink(const char *,
147 struct proc_dir_entry *, const char *); 147 struct proc_dir_entry *, const char *);
148extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); 148extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *);
149extern struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode, 149extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
150 struct proc_dir_entry *parent); 150 struct proc_dir_entry *parent);
151 151
152static inline struct proc_dir_entry *proc_create(const char *name, mode_t mode, 152static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode,
153 struct proc_dir_entry *parent, const struct file_operations *proc_fops) 153 struct proc_dir_entry *parent, const struct file_operations *proc_fops)
154{ 154{
155 return proc_create_data(name, mode, parent, proc_fops, NULL); 155 return proc_create_data(name, mode, parent, proc_fops, NULL);
156} 156}
157 157
158static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 158static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
159 mode_t mode, struct proc_dir_entry *base, 159 umode_t mode, struct proc_dir_entry *base,
160 read_proc_t *read_proc, void * data) 160 read_proc_t *read_proc, void * data)
161{ 161{
162 struct proc_dir_entry *res=create_proc_entry(name,mode,base); 162 struct proc_dir_entry *res=create_proc_entry(name,mode,base);
@@ -168,7 +168,7 @@ static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
168} 168}
169 169
170extern struct proc_dir_entry *proc_net_fops_create(struct net *net, 170extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
171 const char *name, mode_t mode, const struct file_operations *fops); 171 const char *name, umode_t mode, const struct file_operations *fops);
172extern void proc_net_remove(struct net *net, const char *name); 172extern void proc_net_remove(struct net *net, const char *name);
173extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, 173extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
174 struct proc_dir_entry *parent); 174 struct proc_dir_entry *parent);
@@ -185,15 +185,15 @@ static inline void proc_flush_task(struct task_struct *task)
185} 185}
186 186
187static inline struct proc_dir_entry *create_proc_entry(const char *name, 187static inline struct proc_dir_entry *create_proc_entry(const char *name,
188 mode_t mode, struct proc_dir_entry *parent) { return NULL; } 188 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
189static inline struct proc_dir_entry *proc_create(const char *name, 189static inline struct proc_dir_entry *proc_create(const char *name,
190 mode_t mode, struct proc_dir_entry *parent, 190 umode_t mode, struct proc_dir_entry *parent,
191 const struct file_operations *proc_fops) 191 const struct file_operations *proc_fops)
192{ 192{
193 return NULL; 193 return NULL;
194} 194}
195static inline struct proc_dir_entry *proc_create_data(const char *name, 195static inline struct proc_dir_entry *proc_create_data(const char *name,
196 mode_t mode, struct proc_dir_entry *parent, 196 umode_t mode, struct proc_dir_entry *parent,
197 const struct file_operations *proc_fops, void *data) 197 const struct file_operations *proc_fops, void *data)
198{ 198{
199 return NULL; 199 return NULL;
@@ -205,10 +205,10 @@ static inline struct proc_dir_entry *proc_symlink(const char *name,
205static inline struct proc_dir_entry *proc_mkdir(const char *name, 205static inline struct proc_dir_entry *proc_mkdir(const char *name,
206 struct proc_dir_entry *parent) {return NULL;} 206 struct proc_dir_entry *parent) {return NULL;}
207static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, 207static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
208 mode_t mode, struct proc_dir_entry *parent) { return NULL; } 208 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
209 209
210static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 210static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
211 mode_t mode, struct proc_dir_entry *base, 211 umode_t mode, struct proc_dir_entry *base,
212 read_proc_t *read_proc, void * data) { return NULL; } 212 read_proc_t *read_proc, void * data) { return NULL; }
213 213
214struct tty_driver; 214struct tty_driver;
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 3a8f0c9b2933..5bf5500db83d 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -2,7 +2,7 @@
2#define _LINUX_RAMFS_H 2#define _LINUX_RAMFS_H
3 3
4struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir, 4struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir,
5 int mode, dev_t dev); 5 umode_t mode, dev_t dev);
6extern struct dentry *ramfs_mount(struct file_system_type *fs_type, 6extern struct dentry *ramfs_mount(struct file_system_type *fs_type,
7 int flags, const char *dev_name, void *data); 7 int flags, const char *dev_name, void *data);
8 8
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 96d465f8d3e6..26be28fd7b76 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -2056,7 +2056,7 @@ struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key);
2056 2056
2057struct reiserfs_security_handle; 2057struct reiserfs_security_handle;
2058int reiserfs_new_inode(struct reiserfs_transaction_handle *th, 2058int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
2059 struct inode *dir, int mode, 2059 struct inode *dir, umode_t mode,
2060 const char *symname, loff_t i_size, 2060 const char *symname, loff_t i_size,
2061 struct dentry *dentry, struct inode *inode, 2061 struct dentry *dentry, struct inode *inode,
2062 struct reiserfs_security_handle *security); 2062 struct reiserfs_security_handle *security);
diff --git a/include/linux/relay.h b/include/linux/relay.h
index 14a86bc7102b..a822fd71fd64 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -144,7 +144,7 @@ struct rchan_callbacks
144 */ 144 */
145 struct dentry *(*create_buf_file)(const char *filename, 145 struct dentry *(*create_buf_file)(const char *filename,
146 struct dentry *parent, 146 struct dentry *parent,
147 int mode, 147 umode_t mode,
148 struct rchan_buf *buf, 148 struct rchan_buf *buf,
149 int *is_global); 149 int *is_global);
150 150
diff --git a/include/linux/security.h b/include/linux/security.h
index e8c619d39291..535721cc374a 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1424,9 +1424,9 @@ struct security_operations {
1424 1424
1425#ifdef CONFIG_SECURITY_PATH 1425#ifdef CONFIG_SECURITY_PATH
1426 int (*path_unlink) (struct path *dir, struct dentry *dentry); 1426 int (*path_unlink) (struct path *dir, struct dentry *dentry);
1427 int (*path_mkdir) (struct path *dir, struct dentry *dentry, int mode); 1427 int (*path_mkdir) (struct path *dir, struct dentry *dentry, umode_t mode);
1428 int (*path_rmdir) (struct path *dir, struct dentry *dentry); 1428 int (*path_rmdir) (struct path *dir, struct dentry *dentry);
1429 int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode, 1429 int (*path_mknod) (struct path *dir, struct dentry *dentry, umode_t mode,
1430 unsigned int dev); 1430 unsigned int dev);
1431 int (*path_truncate) (struct path *path); 1431 int (*path_truncate) (struct path *path);
1432 int (*path_symlink) (struct path *dir, struct dentry *dentry, 1432 int (*path_symlink) (struct path *dir, struct dentry *dentry,
@@ -1436,7 +1436,7 @@ struct security_operations {
1436 int (*path_rename) (struct path *old_dir, struct dentry *old_dentry, 1436 int (*path_rename) (struct path *old_dir, struct dentry *old_dentry,
1437 struct path *new_dir, struct dentry *new_dentry); 1437 struct path *new_dir, struct dentry *new_dentry);
1438 int (*path_chmod) (struct dentry *dentry, struct vfsmount *mnt, 1438 int (*path_chmod) (struct dentry *dentry, struct vfsmount *mnt,
1439 mode_t mode); 1439 umode_t mode);
1440 int (*path_chown) (struct path *path, uid_t uid, gid_t gid); 1440 int (*path_chown) (struct path *path, uid_t uid, gid_t gid);
1441 int (*path_chroot) (struct path *path); 1441 int (*path_chroot) (struct path *path);
1442#endif 1442#endif
@@ -1447,16 +1447,16 @@ struct security_operations {
1447 const struct qstr *qstr, char **name, 1447 const struct qstr *qstr, char **name,
1448 void **value, size_t *len); 1448 void **value, size_t *len);
1449 int (*inode_create) (struct inode *dir, 1449 int (*inode_create) (struct inode *dir,
1450 struct dentry *dentry, int mode); 1450 struct dentry *dentry, umode_t mode);
1451 int (*inode_link) (struct dentry *old_dentry, 1451 int (*inode_link) (struct dentry *old_dentry,
1452 struct inode *dir, struct dentry *new_dentry); 1452 struct inode *dir, struct dentry *new_dentry);
1453 int (*inode_unlink) (struct inode *dir, struct dentry *dentry); 1453 int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
1454 int (*inode_symlink) (struct inode *dir, 1454 int (*inode_symlink) (struct inode *dir,
1455 struct dentry *dentry, const char *old_name); 1455 struct dentry *dentry, const char *old_name);
1456 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); 1456 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, umode_t mode);
1457 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); 1457 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry);
1458 int (*inode_mknod) (struct inode *dir, struct dentry *dentry, 1458 int (*inode_mknod) (struct inode *dir, struct dentry *dentry,
1459 int mode, dev_t dev); 1459 umode_t mode, dev_t dev);
1460 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, 1460 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry,
1461 struct inode *new_dir, struct dentry *new_dentry); 1461 struct inode *new_dir, struct dentry *new_dentry);
1462 int (*inode_readlink) (struct dentry *dentry); 1462 int (*inode_readlink) (struct dentry *dentry);
@@ -1716,15 +1716,15 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
1716int security_old_inode_init_security(struct inode *inode, struct inode *dir, 1716int security_old_inode_init_security(struct inode *inode, struct inode *dir,
1717 const struct qstr *qstr, char **name, 1717 const struct qstr *qstr, char **name,
1718 void **value, size_t *len); 1718 void **value, size_t *len);
1719int security_inode_create(struct inode *dir, struct dentry *dentry, int mode); 1719int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode);
1720int security_inode_link(struct dentry *old_dentry, struct inode *dir, 1720int security_inode_link(struct dentry *old_dentry, struct inode *dir,
1721 struct dentry *new_dentry); 1721 struct dentry *new_dentry);
1722int security_inode_unlink(struct inode *dir, struct dentry *dentry); 1722int security_inode_unlink(struct inode *dir, struct dentry *dentry);
1723int security_inode_symlink(struct inode *dir, struct dentry *dentry, 1723int security_inode_symlink(struct inode *dir, struct dentry *dentry,
1724 const char *old_name); 1724 const char *old_name);
1725int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode); 1725int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
1726int security_inode_rmdir(struct inode *dir, struct dentry *dentry); 1726int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
1727int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev); 1727int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev);
1728int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, 1728int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
1729 struct inode *new_dir, struct dentry *new_dentry); 1729 struct inode *new_dir, struct dentry *new_dentry);
1730int security_inode_readlink(struct dentry *dentry); 1730int security_inode_readlink(struct dentry *dentry);
@@ -2061,7 +2061,7 @@ static inline int security_old_inode_init_security(struct inode *inode,
2061 2061
2062static inline int security_inode_create(struct inode *dir, 2062static inline int security_inode_create(struct inode *dir,
2063 struct dentry *dentry, 2063 struct dentry *dentry,
2064 int mode) 2064 umode_t mode)
2065{ 2065{
2066 return 0; 2066 return 0;
2067} 2067}
@@ -2855,9 +2855,9 @@ static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi
2855 2855
2856#ifdef CONFIG_SECURITY_PATH 2856#ifdef CONFIG_SECURITY_PATH
2857int security_path_unlink(struct path *dir, struct dentry *dentry); 2857int security_path_unlink(struct path *dir, struct dentry *dentry);
2858int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode); 2858int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode);
2859int security_path_rmdir(struct path *dir, struct dentry *dentry); 2859int security_path_rmdir(struct path *dir, struct dentry *dentry);
2860int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, 2860int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode,
2861 unsigned int dev); 2861 unsigned int dev);
2862int security_path_truncate(struct path *path); 2862int security_path_truncate(struct path *path);
2863int security_path_symlink(struct path *dir, struct dentry *dentry, 2863int security_path_symlink(struct path *dir, struct dentry *dentry,
@@ -2867,7 +2867,7 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir,
2867int security_path_rename(struct path *old_dir, struct dentry *old_dentry, 2867int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
2868 struct path *new_dir, struct dentry *new_dentry); 2868 struct path *new_dir, struct dentry *new_dentry);
2869int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt, 2869int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
2870 mode_t mode); 2870 umode_t mode);
2871int security_path_chown(struct path *path, uid_t uid, gid_t gid); 2871int security_path_chown(struct path *path, uid_t uid, gid_t gid);
2872int security_path_chroot(struct path *path); 2872int security_path_chroot(struct path *path);
2873#else /* CONFIG_SECURITY_PATH */ 2873#else /* CONFIG_SECURITY_PATH */
@@ -2877,7 +2877,7 @@ static inline int security_path_unlink(struct path *dir, struct dentry *dentry)
2877} 2877}
2878 2878
2879static inline int security_path_mkdir(struct path *dir, struct dentry *dentry, 2879static inline int security_path_mkdir(struct path *dir, struct dentry *dentry,
2880 int mode) 2880 umode_t mode)
2881{ 2881{
2882 return 0; 2882 return 0;
2883} 2883}
@@ -2888,7 +2888,7 @@ static inline int security_path_rmdir(struct path *dir, struct dentry *dentry)
2888} 2888}
2889 2889
2890static inline int security_path_mknod(struct path *dir, struct dentry *dentry, 2890static inline int security_path_mknod(struct path *dir, struct dentry *dentry,
2891 int mode, unsigned int dev) 2891 umode_t mode, unsigned int dev)
2892{ 2892{
2893 return 0; 2893 return 0;
2894} 2894}
@@ -2921,7 +2921,7 @@ static inline int security_path_rename(struct path *old_dir,
2921 2921
2922static inline int security_path_chmod(struct dentry *dentry, 2922static inline int security_path_chmod(struct dentry *dentry,
2923 struct vfsmount *mnt, 2923 struct vfsmount *mnt,
2924 mode_t mode) 2924 umode_t mode)
2925{ 2925{
2926 return 0; 2926 return 0;
2927} 2927}
@@ -3010,7 +3010,7 @@ static inline void security_audit_rule_free(void *lsmrule)
3010 3010
3011#ifdef CONFIG_SECURITYFS 3011#ifdef CONFIG_SECURITYFS
3012 3012
3013extern struct dentry *securityfs_create_file(const char *name, mode_t mode, 3013extern struct dentry *securityfs_create_file(const char *name, umode_t mode,
3014 struct dentry *parent, void *data, 3014 struct dentry *parent, void *data,
3015 const struct file_operations *fops); 3015 const struct file_operations *fops);
3016extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); 3016extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
@@ -3025,7 +3025,7 @@ static inline struct dentry *securityfs_create_dir(const char *name,
3025} 3025}
3026 3026
3027static inline struct dentry *securityfs_create_file(const char *name, 3027static inline struct dentry *securityfs_create_file(const char *name,
3028 mode_t mode, 3028 umode_t mode,
3029 struct dentry *parent, 3029 struct dentry *parent,
3030 void *data, 3030 void *data,
3031 const struct file_operations *fops) 3031 const struct file_operations *fops)
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 9291ac3cc627..e4c711c6f321 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -30,7 +30,7 @@ struct shmem_sb_info {
30 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */ 30 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */
31 uid_t uid; /* Mount uid for root directory */ 31 uid_t uid; /* Mount uid for root directory */
32 gid_t gid; /* Mount gid for root directory */ 32 gid_t gid; /* Mount gid for root directory */
33 mode_t mode; /* Mount mode for root directory */ 33 umode_t mode; /* Mount mode for root directory */
34 struct mempolicy *mpol; /* default memory policy for mappings */ 34 struct mempolicy *mpol; /* default memory policy for mappings */
35}; 35};
36 36
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 5efd8cef389e..57531f8e5956 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -203,7 +203,7 @@ extern void cache_unregister(struct cache_detail *cd);
203extern void cache_unregister_net(struct cache_detail *cd, struct net *net); 203extern void cache_unregister_net(struct cache_detail *cd, struct net *net);
204 204
205extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *, 205extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *,
206 mode_t, struct cache_detail *); 206 umode_t, struct cache_detail *);
207extern void sunrpc_cache_unregister_pipefs(struct cache_detail *); 207extern void sunrpc_cache_unregister_pipefs(struct cache_detail *);
208 208
209extern void qword_add(char **bpp, int *lp, char *str); 209extern void qword_add(char **bpp, int *lp, char *str);
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index e4ea43058d8f..2bb03d77375a 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -55,7 +55,7 @@ extern int rpc_remove_client_dir(struct dentry *);
55struct cache_detail; 55struct cache_detail;
56extern struct dentry *rpc_create_cache_dir(struct dentry *, 56extern struct dentry *rpc_create_cache_dir(struct dentry *,
57 struct qstr *, 57 struct qstr *,
58 mode_t umode, 58 umode_t umode,
59 struct cache_detail *); 59 struct cache_detail *);
60extern void rpc_remove_cache_dir(struct dentry *); 60extern void rpc_remove_cache_dir(struct dentry *);
61 61
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 86a24b1166d1..515669fa3c1d 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -475,7 +475,7 @@ asmlinkage long sys_mincore(unsigned long start, size_t len,
475asmlinkage long sys_pivot_root(const char __user *new_root, 475asmlinkage long sys_pivot_root(const char __user *new_root,
476 const char __user *put_old); 476 const char __user *put_old);
477asmlinkage long sys_chroot(const char __user *filename); 477asmlinkage long sys_chroot(const char __user *filename);
478asmlinkage long sys_mknod(const char __user *filename, int mode, 478asmlinkage long sys_mknod(const char __user *filename, umode_t mode,
479 unsigned dev); 479 unsigned dev);
480asmlinkage long sys_link(const char __user *oldname, 480asmlinkage long sys_link(const char __user *oldname,
481 const char __user *newname); 481 const char __user *newname);
@@ -483,8 +483,8 @@ asmlinkage long sys_symlink(const char __user *old, const char __user *new);
483asmlinkage long sys_unlink(const char __user *pathname); 483asmlinkage long sys_unlink(const char __user *pathname);
484asmlinkage long sys_rename(const char __user *oldname, 484asmlinkage long sys_rename(const char __user *oldname,
485 const char __user *newname); 485 const char __user *newname);
486asmlinkage long sys_chmod(const char __user *filename, mode_t mode); 486asmlinkage long sys_chmod(const char __user *filename, umode_t mode);
487asmlinkage long sys_fchmod(unsigned int fd, mode_t mode); 487asmlinkage long sys_fchmod(unsigned int fd, umode_t mode);
488 488
489asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg); 489asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg);
490#if BITS_PER_LONG == 32 490#if BITS_PER_LONG == 32
@@ -517,9 +517,9 @@ asmlinkage long sys_sendfile64(int out_fd, int in_fd,
517 loff_t __user *offset, size_t count); 517 loff_t __user *offset, size_t count);
518asmlinkage long sys_readlink(const char __user *path, 518asmlinkage long sys_readlink(const char __user *path,
519 char __user *buf, int bufsiz); 519 char __user *buf, int bufsiz);
520asmlinkage long sys_creat(const char __user *pathname, int mode); 520asmlinkage long sys_creat(const char __user *pathname, umode_t mode);
521asmlinkage long sys_open(const char __user *filename, 521asmlinkage long sys_open(const char __user *filename,
522 int flags, int mode); 522 int flags, umode_t mode);
523asmlinkage long sys_close(unsigned int fd); 523asmlinkage long sys_close(unsigned int fd);
524asmlinkage long sys_access(const char __user *filename, int mode); 524asmlinkage long sys_access(const char __user *filename, int mode);
525asmlinkage long sys_vhangup(void); 525asmlinkage long sys_vhangup(void);
@@ -582,7 +582,7 @@ asmlinkage long sys_preadv(unsigned long fd, const struct iovec __user *vec,
582asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec, 582asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec,
583 unsigned long vlen, unsigned long pos_l, unsigned long pos_h); 583 unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
584asmlinkage long sys_getcwd(char __user *buf, unsigned long size); 584asmlinkage long sys_getcwd(char __user *buf, unsigned long size);
585asmlinkage long sys_mkdir(const char __user *pathname, int mode); 585asmlinkage long sys_mkdir(const char __user *pathname, umode_t mode);
586asmlinkage long sys_chdir(const char __user *filename); 586asmlinkage long sys_chdir(const char __user *filename);
587asmlinkage long sys_fchdir(unsigned int fd); 587asmlinkage long sys_fchdir(unsigned int fd);
588asmlinkage long sys_rmdir(const char __user *pathname); 588asmlinkage long sys_rmdir(const char __user *pathname);
@@ -679,7 +679,7 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
679asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second, 679asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
680 unsigned long third, void __user *ptr, long fifth); 680 unsigned long third, void __user *ptr, long fifth);
681 681
682asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr); 682asmlinkage long sys_mq_open(const char __user *name, int oflag, umode_t mode, struct mq_attr __user *attr);
683asmlinkage long sys_mq_unlink(const char __user *name); 683asmlinkage long sys_mq_unlink(const char __user *name);
684asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout); 684asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout);
685asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout); 685asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout);
@@ -753,11 +753,11 @@ asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd);
753asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, 753asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
754 __u32 __user *ustatus); 754 __u32 __user *ustatus);
755asmlinkage long sys_spu_create(const char __user *name, 755asmlinkage long sys_spu_create(const char __user *name,
756 unsigned int flags, mode_t mode, int fd); 756 unsigned int flags, umode_t mode, int fd);
757 757
758asmlinkage long sys_mknodat(int dfd, const char __user * filename, int mode, 758asmlinkage long sys_mknodat(int dfd, const char __user * filename, umode_t mode,
759 unsigned dev); 759 unsigned dev);
760asmlinkage long sys_mkdirat(int dfd, const char __user * pathname, int mode); 760asmlinkage long sys_mkdirat(int dfd, const char __user * pathname, umode_t mode);
761asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag); 761asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag);
762asmlinkage long sys_symlinkat(const char __user * oldname, 762asmlinkage long sys_symlinkat(const char __user * oldname,
763 int newdfd, const char __user * newname); 763 int newdfd, const char __user * newname);
@@ -769,11 +769,11 @@ asmlinkage long sys_futimesat(int dfd, const char __user *filename,
769 struct timeval __user *utimes); 769 struct timeval __user *utimes);
770asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode); 770asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode);
771asmlinkage long sys_fchmodat(int dfd, const char __user * filename, 771asmlinkage long sys_fchmodat(int dfd, const char __user * filename,
772 mode_t mode); 772 umode_t mode);
773asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user, 773asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
774 gid_t group, int flag); 774 gid_t group, int flag);
775asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, 775asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
776 int mode); 776 umode_t mode);
777asmlinkage long sys_newfstatat(int dfd, const char __user *filename, 777asmlinkage long sys_newfstatat(int dfd, const char __user *filename,
778 struct stat __user *statbuf, int flag); 778 struct stat __user *statbuf, int flag);
779asmlinkage long sys_fstatat64(int dfd, const char __user *filename, 779asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 703cfa33a3ca..bb9127dd814b 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -1038,7 +1038,7 @@ struct ctl_table
1038 const char *procname; /* Text ID for /proc/sys, or zero */ 1038 const char *procname; /* Text ID for /proc/sys, or zero */
1039 void *data; 1039 void *data;
1040 int maxlen; 1040 int maxlen;
1041 mode_t mode; 1041 umode_t mode;
1042 struct ctl_table *child; 1042 struct ctl_table *child;
1043 struct ctl_table *parent; /* Automatically set */ 1043 struct ctl_table *parent; /* Automatically set */
1044 proc_handler *proc_handler; /* Callback for text formatting */ 1044 proc_handler *proc_handler; /* Callback for text formatting */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index dac0859e6440..0010009b2f00 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -25,7 +25,7 @@ enum kobj_ns_type;
25 25
26struct attribute { 26struct attribute {
27 const char *name; 27 const char *name;
28 mode_t mode; 28 umode_t mode;
29#ifdef CONFIG_DEBUG_LOCK_ALLOC 29#ifdef CONFIG_DEBUG_LOCK_ALLOC
30 struct lock_class_key *key; 30 struct lock_class_key *key;
31 struct lock_class_key skey; 31 struct lock_class_key skey;
@@ -55,7 +55,7 @@ do { \
55 55
56struct attribute_group { 56struct attribute_group {
57 const char *name; 57 const char *name;
58 mode_t (*is_visible)(struct kobject *, 58 umode_t (*is_visible)(struct kobject *,
59 struct attribute *, int); 59 struct attribute *, int);
60 struct attribute **attrs; 60 struct attribute **attrs;
61}; 61};
@@ -133,7 +133,7 @@ int __must_check sysfs_create_file(struct kobject *kobj,
133int __must_check sysfs_create_files(struct kobject *kobj, 133int __must_check sysfs_create_files(struct kobject *kobj,
134 const struct attribute **attr); 134 const struct attribute **attr);
135int __must_check sysfs_chmod_file(struct kobject *kobj, 135int __must_check sysfs_chmod_file(struct kobject *kobj,
136 const struct attribute *attr, mode_t mode); 136 const struct attribute *attr, umode_t mode);
137void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 137void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
138void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); 138void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
139 139
@@ -221,7 +221,7 @@ static inline int sysfs_create_files(struct kobject *kobj,
221} 221}
222 222
223static inline int sysfs_chmod_file(struct kobject *kobj, 223static inline int sysfs_chmod_file(struct kobject *kobj,
224 const struct attribute *attr, mode_t mode) 224 const struct attribute *attr, umode_t mode)
225{ 225{
226 return 0; 226 return 0;
227} 227}
diff --git a/include/linux/types.h b/include/linux/types.h
index 57a97234bec1..f0ac9bda0f78 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -24,6 +24,7 @@ typedef __kernel_fd_set fd_set;
24typedef __kernel_dev_t dev_t; 24typedef __kernel_dev_t dev_t;
25typedef __kernel_ino_t ino_t; 25typedef __kernel_ino_t ino_t;
26typedef __kernel_mode_t mode_t; 26typedef __kernel_mode_t mode_t;
27typedef unsigned short umode_t;
27typedef __kernel_nlink_t nlink_t; 28typedef __kernel_nlink_t nlink_t;
28typedef __kernel_off_t off_t; 29typedef __kernel_off_t off_t;
29typedef __kernel_pid_t pid_t; 30typedef __kernel_pid_t pid_t;
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d3d0c1374334..a59321779f8b 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -935,7 +935,7 @@ extern struct bus_type usb_bus_type;
935 */ 935 */
936struct usb_class_driver { 936struct usb_class_driver {
937 char *name; 937 char *name;
938 char *(*devnode)(struct device *dev, mode_t *mode); 938 char *(*devnode)(struct device *dev, umode_t *mode);
939 const struct file_operations *fops; 939 const struct file_operations *fops;
940 int minor_base; 940 int minor_base;
941}; 941};
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 5994bcc1b017..87f34c3d447d 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -142,7 +142,7 @@ struct iscsi_transport {
142 int (*get_iface_param) (struct iscsi_iface *iface, 142 int (*get_iface_param) (struct iscsi_iface *iface,
143 enum iscsi_param_type param_type, 143 enum iscsi_param_type param_type,
144 int param, char *buf); 144 int param, char *buf);
145 mode_t (*attr_is_visible)(int param_type, int param); 145 umode_t (*attr_is_visible)(int param_type, int param);
146 int (*bsg_request)(struct bsg_job *job); 146 int (*bsg_request)(struct bsg_job *job);
147}; 147};
148 148
diff --git a/include/sound/info.h b/include/sound/info.h
index 5492cc40dc57..9ca1a493d370 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -72,7 +72,7 @@ struct snd_info_entry_ops {
72 72
73struct snd_info_entry { 73struct snd_info_entry {
74 const char *name; 74 const char *name;
75 mode_t mode; 75 umode_t mode;
76 long size; 76 long size;
77 unsigned short content; 77 unsigned short content;
78 union { 78 union {
diff --git a/init/initramfs.c b/init/initramfs.c
index 2531811d42cb..8216c303b082 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -22,7 +22,7 @@ static void __init error(char *x)
22 22
23static __initdata struct hash { 23static __initdata struct hash {
24 int ino, minor, major; 24 int ino, minor, major;
25 mode_t mode; 25 umode_t mode;
26 struct hash *next; 26 struct hash *next;
27 char name[N_ALIGN(PATH_MAX)]; 27 char name[N_ALIGN(PATH_MAX)];
28} *head[32]; 28} *head[32];
@@ -35,7 +35,7 @@ static inline int hash(int major, int minor, int ino)
35} 35}
36 36
37static char __init *find_link(int major, int minor, int ino, 37static char __init *find_link(int major, int minor, int ino,
38 mode_t mode, char *name) 38 umode_t mode, char *name)
39{ 39{
40 struct hash **p, *q; 40 struct hash **p, *q;
41 for (p = head + hash(major, minor, ino); *p; p = &(*p)->next) { 41 for (p = head + hash(major, minor, ino); *p; p = &(*p)->next) {
@@ -120,7 +120,7 @@ static __initdata time_t mtime;
120/* cpio header parsing */ 120/* cpio header parsing */
121 121
122static __initdata unsigned long ino, major, minor, nlink; 122static __initdata unsigned long ino, major, minor, nlink;
123static __initdata mode_t mode; 123static __initdata umode_t mode;
124static __initdata unsigned long body_len, name_len; 124static __initdata unsigned long body_len, name_len;
125static __initdata uid_t uid; 125static __initdata uid_t uid;
126static __initdata gid_t gid; 126static __initdata gid_t gid;
@@ -276,7 +276,7 @@ static int __init maybe_link(void)
276 return 0; 276 return 0;
277} 277}
278 278
279static void __init clean_path(char *path, mode_t mode) 279static void __init clean_path(char *path, umode_t mode)
280{ 280{
281 struct stat st; 281 struct stat st;
282 282
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 4e0be364aa36..9a142a290749 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -108,7 +108,7 @@ static struct ipc_namespace *get_ns_from_inode(struct inode *inode)
108} 108}
109 109
110static struct inode *mqueue_get_inode(struct super_block *sb, 110static struct inode *mqueue_get_inode(struct super_block *sb,
111 struct ipc_namespace *ipc_ns, int mode, 111 struct ipc_namespace *ipc_ns, umode_t mode,
112 struct mq_attr *attr) 112 struct mq_attr *attr)
113{ 113{
114 struct user_struct *u = current_user(); 114 struct user_struct *u = current_user();
@@ -295,7 +295,7 @@ static void mqueue_evict_inode(struct inode *inode)
295} 295}
296 296
297static int mqueue_create(struct inode *dir, struct dentry *dentry, 297static int mqueue_create(struct inode *dir, struct dentry *dentry,
298 int mode, struct nameidata *nd) 298 umode_t mode, struct nameidata *nd)
299{ 299{
300 struct inode *inode; 300 struct inode *inode;
301 struct mq_attr *attr = dentry->d_fsdata; 301 struct mq_attr *attr = dentry->d_fsdata;
@@ -610,7 +610,7 @@ static int mq_attr_ok(struct ipc_namespace *ipc_ns, struct mq_attr *attr)
610 * Invoked when creating a new queue via sys_mq_open 610 * Invoked when creating a new queue via sys_mq_open
611 */ 611 */
612static struct file *do_create(struct ipc_namespace *ipc_ns, struct dentry *dir, 612static struct file *do_create(struct ipc_namespace *ipc_ns, struct dentry *dir,
613 struct dentry *dentry, int oflag, mode_t mode, 613 struct dentry *dentry, int oflag, umode_t mode,
614 struct mq_attr *attr) 614 struct mq_attr *attr)
615{ 615{
616 const struct cred *cred = current_cred(); 616 const struct cred *cred = current_cred();
@@ -679,7 +679,7 @@ err:
679 return ERR_PTR(ret); 679 return ERR_PTR(ret);
680} 680}
681 681
682SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, mode_t, mode, 682SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode,
683 struct mq_attr __user *, u_attr) 683 struct mq_attr __user *, u_attr)
684{ 684{
685 struct dentry *dentry; 685 struct dentry *dentry;
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 47b7fc1ea893..e7fe2b0d29b3 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -210,12 +210,12 @@ struct audit_context {
210 struct { 210 struct {
211 uid_t uid; 211 uid_t uid;
212 gid_t gid; 212 gid_t gid;
213 mode_t mode; 213 umode_t mode;
214 u32 osid; 214 u32 osid;
215 int has_perm; 215 int has_perm;
216 uid_t perm_uid; 216 uid_t perm_uid;
217 gid_t perm_gid; 217 gid_t perm_gid;
218 mode_t perm_mode; 218 umode_t perm_mode;
219 unsigned long qbytes; 219 unsigned long qbytes;
220 } ipc; 220 } ipc;
221 struct { 221 struct {
@@ -234,7 +234,7 @@ struct audit_context {
234 } mq_sendrecv; 234 } mq_sendrecv;
235 struct { 235 struct {
236 int oflag; 236 int oflag;
237 mode_t mode; 237 umode_t mode;
238 struct mq_attr attr; 238 struct mq_attr attr;
239 } mq_open; 239 } mq_open;
240 struct { 240 struct {
@@ -308,7 +308,7 @@ static int audit_match_perm(struct audit_context *ctx, int mask)
308static int audit_match_filetype(struct audit_context *ctx, int which) 308static int audit_match_filetype(struct audit_context *ctx, int which)
309{ 309{
310 unsigned index = which & ~S_IFMT; 310 unsigned index = which & ~S_IFMT;
311 mode_t mode = which & S_IFMT; 311 umode_t mode = which & S_IFMT;
312 312
313 if (unlikely(!ctx)) 313 if (unlikely(!ctx))
314 return 0; 314 return 0;
@@ -1249,7 +1249,7 @@ static void show_special(struct audit_context *context, int *call_panic)
1249 case AUDIT_IPC: { 1249 case AUDIT_IPC: {
1250 u32 osid = context->ipc.osid; 1250 u32 osid = context->ipc.osid;
1251 1251
1252 audit_log_format(ab, "ouid=%u ogid=%u mode=%#o", 1252 audit_log_format(ab, "ouid=%u ogid=%u mode=%#ho",
1253 context->ipc.uid, context->ipc.gid, context->ipc.mode); 1253 context->ipc.uid, context->ipc.gid, context->ipc.mode);
1254 if (osid) { 1254 if (osid) {
1255 char *ctx = NULL; 1255 char *ctx = NULL;
@@ -1267,7 +1267,7 @@ static void show_special(struct audit_context *context, int *call_panic)
1267 ab = audit_log_start(context, GFP_KERNEL, 1267 ab = audit_log_start(context, GFP_KERNEL,
1268 AUDIT_IPC_SET_PERM); 1268 AUDIT_IPC_SET_PERM);
1269 audit_log_format(ab, 1269 audit_log_format(ab,
1270 "qbytes=%lx ouid=%u ogid=%u mode=%#o", 1270 "qbytes=%lx ouid=%u ogid=%u mode=%#ho",
1271 context->ipc.qbytes, 1271 context->ipc.qbytes,
1272 context->ipc.perm_uid, 1272 context->ipc.perm_uid,
1273 context->ipc.perm_gid, 1273 context->ipc.perm_gid,
@@ -1278,7 +1278,7 @@ static void show_special(struct audit_context *context, int *call_panic)
1278 break; } 1278 break; }
1279 case AUDIT_MQ_OPEN: { 1279 case AUDIT_MQ_OPEN: {
1280 audit_log_format(ab, 1280 audit_log_format(ab,
1281 "oflag=0x%x mode=%#o mq_flags=0x%lx mq_maxmsg=%ld " 1281 "oflag=0x%x mode=%#ho mq_flags=0x%lx mq_maxmsg=%ld "
1282 "mq_msgsize=%ld mq_curmsgs=%ld", 1282 "mq_msgsize=%ld mq_curmsgs=%ld",
1283 context->mq_open.oflag, context->mq_open.mode, 1283 context->mq_open.oflag, context->mq_open.mode,
1284 context->mq_open.attr.mq_flags, 1284 context->mq_open.attr.mq_flags,
@@ -1502,7 +1502,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
1502 1502
1503 if (n->ino != (unsigned long)-1) { 1503 if (n->ino != (unsigned long)-1) {
1504 audit_log_format(ab, " inode=%lu" 1504 audit_log_format(ab, " inode=%lu"
1505 " dev=%02x:%02x mode=%#o" 1505 " dev=%02x:%02x mode=%#ho"
1506 " ouid=%u ogid=%u rdev=%02x:%02x", 1506 " ouid=%u ogid=%u rdev=%02x:%02x",
1507 n->ino, 1507 n->ino,
1508 MAJOR(n->dev), 1508 MAJOR(n->dev),
@@ -2160,7 +2160,7 @@ int audit_set_loginuid(struct task_struct *task, uid_t loginuid)
2160 * @attr: queue attributes 2160 * @attr: queue attributes
2161 * 2161 *
2162 */ 2162 */
2163void __audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr) 2163void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
2164{ 2164{
2165 struct audit_context *context = current->audit_context; 2165 struct audit_context *context = current->audit_context;
2166 2166
@@ -2260,7 +2260,7 @@ void __audit_ipc_obj(struct kern_ipc_perm *ipcp)
2260 * 2260 *
2261 * Called only after audit_ipc_obj(). 2261 * Called only after audit_ipc_obj().
2262 */ 2262 */
2263void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode) 2263void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode)
2264{ 2264{
2265 struct audit_context *context = current->audit_context; 2265 struct audit_context *context = current->audit_context;
2266 2266
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index a184470cf9b5..86ebacfd9431 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -760,7 +760,7 @@ EXPORT_SYMBOL_GPL(cgroup_unlock);
760 * -> cgroup_mkdir. 760 * -> cgroup_mkdir.
761 */ 761 */
762 762
763static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode); 763static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
764static struct dentry *cgroup_lookup(struct inode *, struct dentry *, struct nameidata *); 764static struct dentry *cgroup_lookup(struct inode *, struct dentry *, struct nameidata *);
765static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry); 765static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry);
766static int cgroup_populate_dir(struct cgroup *cgrp); 766static int cgroup_populate_dir(struct cgroup *cgrp);
@@ -775,7 +775,7 @@ static struct backing_dev_info cgroup_backing_dev_info = {
775static int alloc_css_id(struct cgroup_subsys *ss, 775static int alloc_css_id(struct cgroup_subsys *ss,
776 struct cgroup *parent, struct cgroup *child); 776 struct cgroup *parent, struct cgroup *child);
777 777
778static struct inode *cgroup_new_inode(mode_t mode, struct super_block *sb) 778static struct inode *cgroup_new_inode(umode_t mode, struct super_block *sb)
779{ 779{
780 struct inode *inode = new_inode(sb); 780 struct inode *inode = new_inode(sb);
781 781
@@ -2585,7 +2585,7 @@ static inline struct cftype *__file_cft(struct file *file)
2585 return __d_cft(file->f_dentry); 2585 return __d_cft(file->f_dentry);
2586} 2586}
2587 2587
2588static int cgroup_create_file(struct dentry *dentry, mode_t mode, 2588static int cgroup_create_file(struct dentry *dentry, umode_t mode,
2589 struct super_block *sb) 2589 struct super_block *sb)
2590{ 2590{
2591 struct inode *inode; 2591 struct inode *inode;
@@ -2626,7 +2626,7 @@ static int cgroup_create_file(struct dentry *dentry, mode_t mode,
2626 * @mode: mode to set on new directory. 2626 * @mode: mode to set on new directory.
2627 */ 2627 */
2628static int cgroup_create_dir(struct cgroup *cgrp, struct dentry *dentry, 2628static int cgroup_create_dir(struct cgroup *cgrp, struct dentry *dentry,
2629 mode_t mode) 2629 umode_t mode)
2630{ 2630{
2631 struct dentry *parent; 2631 struct dentry *parent;
2632 int error = 0; 2632 int error = 0;
@@ -2653,9 +2653,9 @@ static int cgroup_create_dir(struct cgroup *cgrp, struct dentry *dentry,
2653 * returns S_IRUGO if it has only a read handler 2653 * returns S_IRUGO if it has only a read handler
2654 * returns S_IWUSR if it has only a write hander 2654 * returns S_IWUSR if it has only a write hander
2655 */ 2655 */
2656static mode_t cgroup_file_mode(const struct cftype *cft) 2656static umode_t cgroup_file_mode(const struct cftype *cft)
2657{ 2657{
2658 mode_t mode = 0; 2658 umode_t mode = 0;
2659 2659
2660 if (cft->mode) 2660 if (cft->mode)
2661 return cft->mode; 2661 return cft->mode;
@@ -2678,7 +2678,7 @@ int cgroup_add_file(struct cgroup *cgrp,
2678 struct dentry *dir = cgrp->dentry; 2678 struct dentry *dir = cgrp->dentry;
2679 struct dentry *dentry; 2679 struct dentry *dentry;
2680 int error; 2680 int error;
2681 mode_t mode; 2681 umode_t mode;
2682 2682
2683 char name[MAX_CGROUP_TYPE_NAMELEN + MAX_CFTYPE_NAME + 2] = { 0 }; 2683 char name[MAX_CGROUP_TYPE_NAMELEN + MAX_CFTYPE_NAME + 2] = { 0 };
2684 if (subsys && !test_bit(ROOT_NOPREFIX, &cgrp->root->flags)) { 2684 if (subsys && !test_bit(ROOT_NOPREFIX, &cgrp->root->flags)) {
@@ -3752,7 +3752,7 @@ static void cgroup_unlock_hierarchy(struct cgroupfs_root *root)
3752 * Must be called with the mutex on the parent inode held 3752 * Must be called with the mutex on the parent inode held
3753 */ 3753 */
3754static long cgroup_create(struct cgroup *parent, struct dentry *dentry, 3754static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
3755 mode_t mode) 3755 umode_t mode)
3756{ 3756{
3757 struct cgroup *cgrp; 3757 struct cgroup *cgrp;
3758 struct cgroupfs_root *root = parent->root; 3758 struct cgroupfs_root *root = parent->root;
@@ -3846,7 +3846,7 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
3846 return err; 3846 return err;
3847} 3847}
3848 3848
3849static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode) 3849static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
3850{ 3850{
3851 struct cgroup *c_parent = dentry->d_parent->d_fsdata; 3851 struct cgroup *c_parent = dentry->d_parent->d_fsdata;
3852 3852
diff --git a/kernel/relay.c b/kernel/relay.c
index 226fade4d727..4335e1d7ee2d 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -302,7 +302,7 @@ static void buf_unmapped_default_callback(struct rchan_buf *buf,
302 */ 302 */
303static struct dentry *create_buf_file_default_callback(const char *filename, 303static struct dentry *create_buf_file_default_callback(const char *filename,
304 struct dentry *parent, 304 struct dentry *parent,
305 int mode, 305 umode_t mode,
306 struct rchan_buf *buf, 306 struct rchan_buf *buf,
307 int *is_global) 307 int *is_global)
308{ 308{
diff --git a/kernel/sched.c b/kernel/sched.c
index d6b149ccf925..e64f45741e0e 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6480,7 +6480,7 @@ static void sd_free_ctl_entry(struct ctl_table **tablep)
6480static void 6480static void
6481set_table_entry(struct ctl_table *entry, 6481set_table_entry(struct ctl_table *entry,
6482 const char *procname, void *data, int maxlen, 6482 const char *procname, void *data, int maxlen,
6483 mode_t mode, proc_handler *proc_handler) 6483 umode_t mode, proc_handler *proc_handler)
6484{ 6484{
6485 entry->procname = procname; 6485 entry->procname = procname;
6486 entry->data = data; 6486 entry->data = data;
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 16fc34a0806f..cdea7b56b0c9 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -402,7 +402,7 @@ static int blk_remove_buf_file_callback(struct dentry *dentry)
402 402
403static struct dentry *blk_create_buf_file_callback(const char *filename, 403static struct dentry *blk_create_buf_file_callback(const char *filename,
404 struct dentry *parent, 404 struct dentry *parent,
405 int mode, 405 umode_t mode,
406 struct rchan_buf *buf, 406 struct rchan_buf *buf,
407 int *is_global) 407 int *is_global)
408{ 408{
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index f2bd275bb60f..660b069a0f99 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4385,7 +4385,7 @@ static const struct file_operations trace_options_core_fops = {
4385}; 4385};
4386 4386
4387struct dentry *trace_create_file(const char *name, 4387struct dentry *trace_create_file(const char *name,
4388 mode_t mode, 4388 umode_t mode,
4389 struct dentry *parent, 4389 struct dentry *parent,
4390 void *data, 4390 void *data,
4391 const struct file_operations *fops) 4391 const struct file_operations *fops)
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 092e1f8d18dc..0154c0b850de 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -312,7 +312,7 @@ void tracing_reset_current(int cpu);
312void tracing_reset_current_online_cpus(void); 312void tracing_reset_current_online_cpus(void);
313int tracing_open_generic(struct inode *inode, struct file *filp); 313int tracing_open_generic(struct inode *inode, struct file *filp);
314struct dentry *trace_create_file(const char *name, 314struct dentry *trace_create_file(const char *name,
315 mode_t mode, 315 umode_t mode,
316 struct dentry *parent, 316 struct dentry *parent,
317 void *data, 317 void *data,
318 const struct file_operations *fops); 318 const struct file_operations *fops);
diff --git a/lib/fault-inject.c b/lib/fault-inject.c
index 4f7554025e30..b4801f51b607 100644
--- a/lib/fault-inject.c
+++ b/lib/fault-inject.c
@@ -149,7 +149,7 @@ static int debugfs_ul_get(void *data, u64 *val)
149 149
150DEFINE_SIMPLE_ATTRIBUTE(fops_ul, debugfs_ul_get, debugfs_ul_set, "%llu\n"); 150DEFINE_SIMPLE_ATTRIBUTE(fops_ul, debugfs_ul_get, debugfs_ul_set, "%llu\n");
151 151
152static struct dentry *debugfs_create_ul(const char *name, mode_t mode, 152static struct dentry *debugfs_create_ul(const char *name, umode_t mode,
153 struct dentry *parent, unsigned long *value) 153 struct dentry *parent, unsigned long *value)
154{ 154{
155 return debugfs_create_file(name, mode, parent, value, &fops_ul); 155 return debugfs_create_file(name, mode, parent, value, &fops_ul);
@@ -169,7 +169,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_stacktrace_depth, debugfs_ul_get,
169 debugfs_stacktrace_depth_set, "%llu\n"); 169 debugfs_stacktrace_depth_set, "%llu\n");
170 170
171static struct dentry *debugfs_create_stacktrace_depth( 171static struct dentry *debugfs_create_stacktrace_depth(
172 const char *name, mode_t mode, 172 const char *name, umode_t mode,
173 struct dentry *parent, unsigned long *value) 173 struct dentry *parent, unsigned long *value)
174{ 174{
175 return debugfs_create_file(name, mode, parent, value, 175 return debugfs_create_file(name, mode, parent, value,
@@ -193,7 +193,7 @@ static int debugfs_atomic_t_get(void *data, u64 *val)
193DEFINE_SIMPLE_ATTRIBUTE(fops_atomic_t, debugfs_atomic_t_get, 193DEFINE_SIMPLE_ATTRIBUTE(fops_atomic_t, debugfs_atomic_t_get,
194 debugfs_atomic_t_set, "%lld\n"); 194 debugfs_atomic_t_set, "%lld\n");
195 195
196static struct dentry *debugfs_create_atomic_t(const char *name, mode_t mode, 196static struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode,
197 struct dentry *parent, atomic_t *value) 197 struct dentry *parent, atomic_t *value)
198{ 198{
199 return debugfs_create_file(name, mode, parent, value, &fops_atomic_t); 199 return debugfs_create_file(name, mode, parent, value, &fops_atomic_t);
@@ -202,7 +202,7 @@ static struct dentry *debugfs_create_atomic_t(const char *name, mode_t mode,
202struct dentry *fault_create_debugfs_attr(const char *name, 202struct dentry *fault_create_debugfs_attr(const char *name,
203 struct dentry *parent, struct fault_attr *attr) 203 struct dentry *parent, struct fault_attr *attr)
204{ 204{
205 mode_t mode = S_IFREG | S_IRUSR | S_IWUSR; 205 umode_t mode = S_IFREG | S_IRUSR | S_IWUSR;
206 struct dentry *dir; 206 struct dentry *dir;
207 207
208 dir = debugfs_create_dir(name, parent); 208 dir = debugfs_create_dir(name, parent);
diff --git a/mm/failslab.c b/mm/failslab.c
index 0dd7b8fec71c..fefaabaab76d 100644
--- a/mm/failslab.c
+++ b/mm/failslab.c
@@ -35,7 +35,7 @@ __setup("failslab=", setup_failslab);
35static int __init failslab_debugfs_init(void) 35static int __init failslab_debugfs_init(void)
36{ 36{
37 struct dentry *dir; 37 struct dentry *dir;
38 mode_t mode = S_IFREG | S_IRUSR | S_IWUSR; 38 umode_t mode = S_IFREG | S_IRUSR | S_IWUSR;
39 39
40 dir = fault_create_debugfs_attr("failslab", NULL, &failslab.attr); 40 dir = fault_create_debugfs_attr("failslab", NULL, &failslab.attr);
41 if (IS_ERR(dir)) 41 if (IS_ERR(dir))
diff --git a/mm/filemap.c b/mm/filemap.c
index 5f0a3c91fdac..a0701e6eec10 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1968,7 +1968,7 @@ EXPORT_SYMBOL(read_cache_page);
1968 */ 1968 */
1969int should_remove_suid(struct dentry *dentry) 1969int should_remove_suid(struct dentry *dentry)
1970{ 1970{
1971 mode_t mode = dentry->d_inode->i_mode; 1971 umode_t mode = dentry->d_inode->i_mode;
1972 int kill = 0; 1972 int kill = 0;
1973 1973
1974 /* suid always must be killed */ 1974 /* suid always must be killed */
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2b8ba3aebf6e..99930ec7d140 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1408,7 +1408,7 @@ static int should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
1408 1408
1409static int __init fail_page_alloc_debugfs(void) 1409static int __init fail_page_alloc_debugfs(void)
1410{ 1410{
1411 mode_t mode = S_IFREG | S_IRUSR | S_IWUSR; 1411 umode_t mode = S_IFREG | S_IRUSR | S_IWUSR;
1412 struct dentry *dir; 1412 struct dentry *dir;
1413 1413
1414 dir = fault_create_debugfs_attr("fail_page_alloc", NULL, 1414 dir = fault_create_debugfs_attr("fail_page_alloc", NULL,
diff --git a/mm/shmem.c b/mm/shmem.c
index c58594c06569..86a19efc36fb 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1092,7 +1092,7 @@ static int shmem_mmap(struct file *file, struct vm_area_struct *vma)
1092} 1092}
1093 1093
1094static struct inode *shmem_get_inode(struct super_block *sb, const struct inode *dir, 1094static struct inode *shmem_get_inode(struct super_block *sb, const struct inode *dir,
1095 int mode, dev_t dev, unsigned long flags) 1095 umode_t mode, dev_t dev, unsigned long flags)
1096{ 1096{
1097 struct inode *inode; 1097 struct inode *inode;
1098 struct shmem_inode_info *info; 1098 struct shmem_inode_info *info;
@@ -1456,7 +1456,7 @@ static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf)
1456 * File creation. Allocate an inode, and we're done.. 1456 * File creation. Allocate an inode, and we're done..
1457 */ 1457 */
1458static int 1458static int
1459shmem_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) 1459shmem_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
1460{ 1460{
1461 struct inode *inode; 1461 struct inode *inode;
1462 int error = -ENOSPC; 1462 int error = -ENOSPC;
@@ -1489,7 +1489,7 @@ shmem_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
1489 return error; 1489 return error;
1490} 1490}
1491 1491
1492static int shmem_mkdir(struct inode *dir, struct dentry *dentry, int mode) 1492static int shmem_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
1493{ 1493{
1494 int error; 1494 int error;
1495 1495
@@ -1499,7 +1499,7 @@ static int shmem_mkdir(struct inode *dir, struct dentry *dentry, int mode)
1499 return 0; 1499 return 0;
1500} 1500}
1501 1501
1502static int shmem_create(struct inode *dir, struct dentry *dentry, int mode, 1502static int shmem_create(struct inode *dir, struct dentry *dentry, umode_t mode,
1503 struct nameidata *nd) 1503 struct nameidata *nd)
1504{ 1504{
1505 return shmem_mknod(dir, dentry, mode | S_IFREG, 0); 1505 return shmem_mknod(dir, dentry, mode | S_IFREG, 0);
@@ -2128,7 +2128,7 @@ static int shmem_show_options(struct seq_file *seq, struct vfsmount *vfs)
2128 if (sbinfo->max_inodes != shmem_default_max_inodes()) 2128 if (sbinfo->max_inodes != shmem_default_max_inodes())
2129 seq_printf(seq, ",nr_inodes=%lu", sbinfo->max_inodes); 2129 seq_printf(seq, ",nr_inodes=%lu", sbinfo->max_inodes);
2130 if (sbinfo->mode != (S_IRWXUGO | S_ISVTX)) 2130 if (sbinfo->mode != (S_IRWXUGO | S_ISVTX))
2131 seq_printf(seq, ",mode=%03o", sbinfo->mode); 2131 seq_printf(seq, ",mode=%03ho", sbinfo->mode);
2132 if (sbinfo->uid != 0) 2132 if (sbinfo->uid != 0)
2133 seq_printf(seq, ",uid=%u", sbinfo->uid); 2133 seq_printf(seq, ",uid=%u", sbinfo->uid);
2134 if (sbinfo->gid != 0) 2134 if (sbinfo->gid != 0)
@@ -2239,7 +2239,7 @@ static void shmem_destroy_callback(struct rcu_head *head)
2239 2239
2240static void shmem_destroy_inode(struct inode *inode) 2240static void shmem_destroy_inode(struct inode *inode)
2241{ 2241{
2242 if ((inode->i_mode & S_IFMT) == S_IFREG) 2242 if (S_ISREG(inode->i_mode))
2243 mpol_free_shared_policy(&SHMEM_I(inode)->policy); 2243 mpol_free_shared_policy(&SHMEM_I(inode)->policy);
2244 call_rcu(&inode->i_rcu, shmem_destroy_callback); 2244 call_rcu(&inode->i_rcu, shmem_destroy_callback);
2245} 2245}
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 72ad836e4fe0..03b56bc3b659 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1778,7 +1778,7 @@ const struct file_operations cache_flush_operations_pipefs = {
1778}; 1778};
1779 1779
1780int sunrpc_cache_register_pipefs(struct dentry *parent, 1780int sunrpc_cache_register_pipefs(struct dentry *parent,
1781 const char *name, mode_t umode, 1781 const char *name, umode_t umode,
1782 struct cache_detail *cd) 1782 struct cache_detail *cd)
1783{ 1783{
1784 struct qstr q; 1784 struct qstr q;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 60564bcb8067..63a7a7add21e 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -953,7 +953,7 @@ static void rpc_cachedir_depopulate(struct dentry *dentry)
953} 953}
954 954
955struct dentry *rpc_create_cache_dir(struct dentry *parent, struct qstr *name, 955struct dentry *rpc_create_cache_dir(struct dentry *parent, struct qstr *name,
956 mode_t umode, struct cache_detail *cd) 956 umode_t umode, struct cache_detail *cd)
957{ 957{
958 return rpc_mkdir_populate(parent, name, umode, NULL, 958 return rpc_mkdir_populate(parent, name, umode, NULL,
959 rpc_cachedir_populate, cd); 959 rpc_cachedir_populate, cd);
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index b595a3d8679f..412a99f4a3f7 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -847,7 +847,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
847 atomic_set(&addr->refcnt, 1); 847 atomic_set(&addr->refcnt, 1);
848 848
849 if (sun_path[0]) { 849 if (sun_path[0]) {
850 unsigned int mode; 850 umode_t mode;
851 err = 0; 851 err = 0;
852 /* 852 /*
853 * Get the parent directory, calculate the hash for last 853 * Get the parent directory, calculate the hash for last
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 69ddb47787b2..e39df6d43779 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -165,7 +165,7 @@ static void __init aafs_remove(const char *name)
165 * 165 *
166 * Used aafs_remove to remove entries created with this fn. 166 * Used aafs_remove to remove entries created with this fn.
167 */ 167 */
168static int __init aafs_create(const char *name, int mask, 168static int __init aafs_create(const char *name, umode_t mask,
169 const struct file_operations *fops) 169 const struct file_operations *fops)
170{ 170{
171 struct dentry *dentry; 171 struct dentry *dentry;
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index 37832026e58a..c0a399ec1df9 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -262,7 +262,7 @@ static int apparmor_path_unlink(struct path *dir, struct dentry *dentry)
262} 262}
263 263
264static int apparmor_path_mkdir(struct path *dir, struct dentry *dentry, 264static int apparmor_path_mkdir(struct path *dir, struct dentry *dentry,
265 int mode) 265 umode_t mode)
266{ 266{
267 return common_perm_create(OP_MKDIR, dir, dentry, AA_MAY_CREATE, 267 return common_perm_create(OP_MKDIR, dir, dentry, AA_MAY_CREATE,
268 S_IFDIR); 268 S_IFDIR);
@@ -274,7 +274,7 @@ static int apparmor_path_rmdir(struct path *dir, struct dentry *dentry)
274} 274}
275 275
276static int apparmor_path_mknod(struct path *dir, struct dentry *dentry, 276static int apparmor_path_mknod(struct path *dir, struct dentry *dentry,
277 int mode, unsigned int dev) 277 umode_t mode, unsigned int dev)
278{ 278{
279 return common_perm_create(OP_MKNOD, dir, dentry, AA_MAY_CREATE, mode); 279 return common_perm_create(OP_MKNOD, dir, dentry, AA_MAY_CREATE, mode);
280} 280}
@@ -345,7 +345,7 @@ static int apparmor_path_rename(struct path *old_dir, struct dentry *old_dentry,
345} 345}
346 346
347static int apparmor_path_chmod(struct dentry *dentry, struct vfsmount *mnt, 347static int apparmor_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
348 mode_t mode) 348 umode_t mode)
349{ 349{
350 if (!mediated_filesystem(dentry->d_inode)) 350 if (!mediated_filesystem(dentry->d_inode))
351 return 0; 351 return 0;
diff --git a/security/capability.c b/security/capability.c
index 2984ea4f776f..156816d451ba 100644
--- a/security/capability.c
+++ b/security/capability.c
@@ -125,7 +125,7 @@ static int cap_inode_init_security(struct inode *inode, struct inode *dir,
125} 125}
126 126
127static int cap_inode_create(struct inode *inode, struct dentry *dentry, 127static int cap_inode_create(struct inode *inode, struct dentry *dentry,
128 int mask) 128 umode_t mask)
129{ 129{
130 return 0; 130 return 0;
131} 131}
@@ -148,7 +148,7 @@ static int cap_inode_symlink(struct inode *inode, struct dentry *dentry,
148} 148}
149 149
150static int cap_inode_mkdir(struct inode *inode, struct dentry *dentry, 150static int cap_inode_mkdir(struct inode *inode, struct dentry *dentry,
151 int mask) 151 umode_t mask)
152{ 152{
153 return 0; 153 return 0;
154} 154}
@@ -159,7 +159,7 @@ static int cap_inode_rmdir(struct inode *inode, struct dentry *dentry)
159} 159}
160 160
161static int cap_inode_mknod(struct inode *inode, struct dentry *dentry, 161static int cap_inode_mknod(struct inode *inode, struct dentry *dentry,
162 int mode, dev_t dev) 162 umode_t mode, dev_t dev)
163{ 163{
164 return 0; 164 return 0;
165} 165}
@@ -235,13 +235,13 @@ static void cap_inode_getsecid(const struct inode *inode, u32 *secid)
235} 235}
236 236
237#ifdef CONFIG_SECURITY_PATH 237#ifdef CONFIG_SECURITY_PATH
238static int cap_path_mknod(struct path *dir, struct dentry *dentry, int mode, 238static int cap_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode,
239 unsigned int dev) 239 unsigned int dev)
240{ 240{
241 return 0; 241 return 0;
242} 242}
243 243
244static int cap_path_mkdir(struct path *dir, struct dentry *dentry, int mode) 244static int cap_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode)
245{ 245{
246 return 0; 246 return 0;
247} 247}
@@ -280,7 +280,7 @@ static int cap_path_truncate(struct path *path)
280} 280}
281 281
282static int cap_path_chmod(struct dentry *dentry, struct vfsmount *mnt, 282static int cap_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
283 mode_t mode) 283 umode_t mode)
284{ 284{
285 return 0; 285 return 0;
286} 286}
diff --git a/security/inode.c b/security/inode.c
index a67004f9d106..90a70a67d835 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -56,7 +56,7 @@ static const struct file_operations default_file_ops = {
56 .llseek = noop_llseek, 56 .llseek = noop_llseek,
57}; 57};
58 58
59static struct inode *get_inode(struct super_block *sb, int mode, dev_t dev) 59static struct inode *get_inode(struct super_block *sb, umode_t mode, dev_t dev)
60{ 60{
61 struct inode *inode = new_inode(sb); 61 struct inode *inode = new_inode(sb);
62 62
@@ -85,7 +85,7 @@ static struct inode *get_inode(struct super_block *sb, int mode, dev_t dev)
85 85
86/* SMP-safe */ 86/* SMP-safe */
87static int mknod(struct inode *dir, struct dentry *dentry, 87static int mknod(struct inode *dir, struct dentry *dentry,
88 int mode, dev_t dev) 88 umode_t mode, dev_t dev)
89{ 89{
90 struct inode *inode; 90 struct inode *inode;
91 int error = -ENOMEM; 91 int error = -ENOMEM;
@@ -102,7 +102,7 @@ static int mknod(struct inode *dir, struct dentry *dentry,
102 return error; 102 return error;
103} 103}
104 104
105static int mkdir(struct inode *dir, struct dentry *dentry, int mode) 105static int mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
106{ 106{
107 int res; 107 int res;
108 108
@@ -113,7 +113,7 @@ static int mkdir(struct inode *dir, struct dentry *dentry, int mode)
113 return res; 113 return res;
114} 114}
115 115
116static int create(struct inode *dir, struct dentry *dentry, int mode) 116static int create(struct inode *dir, struct dentry *dentry, umode_t mode)
117{ 117{
118 mode = (mode & S_IALLUGO) | S_IFREG; 118 mode = (mode & S_IALLUGO) | S_IFREG;
119 return mknod(dir, dentry, mode, 0); 119 return mknod(dir, dentry, mode, 0);
@@ -145,7 +145,7 @@ static struct file_system_type fs_type = {
145 .kill_sb = kill_litter_super, 145 .kill_sb = kill_litter_super,
146}; 146};
147 147
148static int create_by_name(const char *name, mode_t mode, 148static int create_by_name(const char *name, umode_t mode,
149 struct dentry *parent, 149 struct dentry *parent,
150 struct dentry **dentry) 150 struct dentry **dentry)
151{ 151{
@@ -164,7 +164,7 @@ static int create_by_name(const char *name, mode_t mode,
164 mutex_lock(&parent->d_inode->i_mutex); 164 mutex_lock(&parent->d_inode->i_mutex);
165 *dentry = lookup_one_len(name, parent, strlen(name)); 165 *dentry = lookup_one_len(name, parent, strlen(name));
166 if (!IS_ERR(*dentry)) { 166 if (!IS_ERR(*dentry)) {
167 if ((mode & S_IFMT) == S_IFDIR) 167 if (S_ISDIR(mode))
168 error = mkdir(parent->d_inode, *dentry, mode); 168 error = mkdir(parent->d_inode, *dentry, mode);
169 else 169 else
170 error = create(parent->d_inode, *dentry, mode); 170 error = create(parent->d_inode, *dentry, mode);
@@ -205,7 +205,7 @@ static int create_by_name(const char *name, mode_t mode,
205 * If securityfs is not enabled in the kernel, the value %-ENODEV is 205 * If securityfs is not enabled in the kernel, the value %-ENODEV is
206 * returned. 206 * returned.
207 */ 207 */
208struct dentry *securityfs_create_file(const char *name, mode_t mode, 208struct dentry *securityfs_create_file(const char *name, umode_t mode,
209 struct dentry *parent, void *data, 209 struct dentry *parent, void *data,
210 const struct file_operations *fops) 210 const struct file_operations *fops)
211{ 211{
diff --git a/security/security.c b/security/security.c
index e2f684aeb70c..151152de1a0a 100644
--- a/security/security.c
+++ b/security/security.c
@@ -388,7 +388,7 @@ int security_old_inode_init_security(struct inode *inode, struct inode *dir,
388EXPORT_SYMBOL(security_old_inode_init_security); 388EXPORT_SYMBOL(security_old_inode_init_security);
389 389
390#ifdef CONFIG_SECURITY_PATH 390#ifdef CONFIG_SECURITY_PATH
391int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, 391int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode,
392 unsigned int dev) 392 unsigned int dev)
393{ 393{
394 if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) 394 if (unlikely(IS_PRIVATE(dir->dentry->d_inode)))
@@ -397,7 +397,7 @@ int security_path_mknod(struct path *dir, struct dentry *dentry, int mode,
397} 397}
398EXPORT_SYMBOL(security_path_mknod); 398EXPORT_SYMBOL(security_path_mknod);
399 399
400int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode) 400int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode)
401{ 401{
402 if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) 402 if (unlikely(IS_PRIVATE(dir->dentry->d_inode)))
403 return 0; 403 return 0;
@@ -455,7 +455,7 @@ int security_path_truncate(struct path *path)
455} 455}
456 456
457int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt, 457int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
458 mode_t mode) 458 umode_t mode)
459{ 459{
460 if (unlikely(IS_PRIVATE(dentry->d_inode))) 460 if (unlikely(IS_PRIVATE(dentry->d_inode)))
461 return 0; 461 return 0;
@@ -475,7 +475,7 @@ int security_path_chroot(struct path *path)
475} 475}
476#endif 476#endif
477 477
478int security_inode_create(struct inode *dir, struct dentry *dentry, int mode) 478int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode)
479{ 479{
480 if (unlikely(IS_PRIVATE(dir))) 480 if (unlikely(IS_PRIVATE(dir)))
481 return 0; 481 return 0;
@@ -506,7 +506,7 @@ int security_inode_symlink(struct inode *dir, struct dentry *dentry,
506 return security_ops->inode_symlink(dir, dentry, old_name); 506 return security_ops->inode_symlink(dir, dentry, old_name);
507} 507}
508 508
509int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode) 509int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
510{ 510{
511 if (unlikely(IS_PRIVATE(dir))) 511 if (unlikely(IS_PRIVATE(dir)))
512 return 0; 512 return 0;
@@ -521,7 +521,7 @@ int security_inode_rmdir(struct inode *dir, struct dentry *dentry)
521 return security_ops->inode_rmdir(dir, dentry); 521 return security_ops->inode_rmdir(dir, dentry);
522} 522}
523 523
524int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) 524int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
525{ 525{
526 if (unlikely(IS_PRIVATE(dir))) 526 if (unlikely(IS_PRIVATE(dir)))
527 return 0; 527 return 0;
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 1126c10a5e82..4def4d92aaee 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1740,7 +1740,7 @@ static inline u32 file_mask_to_av(int mode, int mask)
1740{ 1740{
1741 u32 av = 0; 1741 u32 av = 0;
1742 1742
1743 if ((mode & S_IFMT) != S_IFDIR) { 1743 if (!S_ISDIR(mode)) {
1744 if (mask & MAY_EXEC) 1744 if (mask & MAY_EXEC)
1745 av |= FILE__EXECUTE; 1745 av |= FILE__EXECUTE;
1746 if (mask & MAY_READ) 1746 if (mask & MAY_READ)
@@ -2598,7 +2598,7 @@ static int selinux_inode_init_security(struct inode *inode, struct inode *dir,
2598 return 0; 2598 return 0;
2599} 2599}
2600 2600
2601static int selinux_inode_create(struct inode *dir, struct dentry *dentry, int mask) 2601static int selinux_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode)
2602{ 2602{
2603 return may_create(dir, dentry, SECCLASS_FILE); 2603 return may_create(dir, dentry, SECCLASS_FILE);
2604} 2604}
@@ -2618,7 +2618,7 @@ static int selinux_inode_symlink(struct inode *dir, struct dentry *dentry, const
2618 return may_create(dir, dentry, SECCLASS_LNK_FILE); 2618 return may_create(dir, dentry, SECCLASS_LNK_FILE);
2619} 2619}
2620 2620
2621static int selinux_inode_mkdir(struct inode *dir, struct dentry *dentry, int mask) 2621static int selinux_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mask)
2622{ 2622{
2623 return may_create(dir, dentry, SECCLASS_DIR); 2623 return may_create(dir, dentry, SECCLASS_DIR);
2624} 2624}
@@ -2628,7 +2628,7 @@ static int selinux_inode_rmdir(struct inode *dir, struct dentry *dentry)
2628 return may_link(dir, dentry, MAY_RMDIR); 2628 return may_link(dir, dentry, MAY_RMDIR);
2629} 2629}
2630 2630
2631static int selinux_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) 2631static int selinux_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
2632{ 2632{
2633 return may_create(dir, dentry, inode_mode_to_security_class(mode)); 2633 return may_create(dir, dentry, inode_mode_to_security_class(mode));
2634} 2634}
diff --git a/security/tomoyo/audit.c b/security/tomoyo/audit.c
index 075c3a6d1649..5ca47ea3049f 100644
--- a/security/tomoyo/audit.c
+++ b/security/tomoyo/audit.c
@@ -112,7 +112,7 @@ out:
112 * 112 *
113 * Returns file type string. 113 * Returns file type string.
114 */ 114 */
115static inline const char *tomoyo_filetype(const mode_t mode) 115static inline const char *tomoyo_filetype(const umode_t mode)
116{ 116{
117 switch (mode & S_IFMT) { 117 switch (mode & S_IFMT) {
118 case S_IFREG: 118 case S_IFREG:
@@ -180,7 +180,7 @@ static char *tomoyo_print_header(struct tomoyo_request_info *r)
180 for (i = 0; i < TOMOYO_MAX_PATH_STAT; i++) { 180 for (i = 0; i < TOMOYO_MAX_PATH_STAT; i++) {
181 struct tomoyo_mini_stat *stat; 181 struct tomoyo_mini_stat *stat;
182 unsigned int dev; 182 unsigned int dev;
183 mode_t mode; 183 umode_t mode;
184 if (!obj->stat_valid[i]) 184 if (!obj->stat_valid[i])
185 continue; 185 continue;
186 stat = &obj->stat[i]; 186 stat = &obj->stat[i];
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h
index ed311d7a8ce0..deeab7be5b97 100644
--- a/security/tomoyo/common.h
+++ b/security/tomoyo/common.h
@@ -564,7 +564,7 @@ struct tomoyo_mini_stat {
564 uid_t uid; 564 uid_t uid;
565 gid_t gid; 565 gid_t gid;
566 ino_t ino; 566 ino_t ino;
567 mode_t mode; 567 umode_t mode;
568 dev_t dev; 568 dev_t dev;
569 dev_t rdev; 569 dev_t rdev;
570}; 570};
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c
index 2cb5db589c9d..80a09c37cac8 100644
--- a/security/tomoyo/realpath.c
+++ b/security/tomoyo/realpath.c
@@ -5,6 +5,7 @@
5 */ 5 */
6 6
7#include "common.h" 7#include "common.h"
8#include <linux/magic.h>
8 9
9/** 10/**
10 * tomoyo_encode2 - Encode binary string to ascii string. 11 * tomoyo_encode2 - Encode binary string to ascii string.
diff --git a/security/tomoyo/securityfs_if.c b/security/tomoyo/securityfs_if.c
index 2672ac4f3beb..482b2a5f48f0 100644
--- a/security/tomoyo/securityfs_if.c
+++ b/security/tomoyo/securityfs_if.c
@@ -224,7 +224,7 @@ static const struct file_operations tomoyo_operations = {
224 * 224 *
225 * Returns nothing. 225 * Returns nothing.
226 */ 226 */
227static void __init tomoyo_create_entry(const char *name, const mode_t mode, 227static void __init tomoyo_create_entry(const char *name, const umode_t mode,
228 struct dentry *parent, const u8 key) 228 struct dentry *parent, const u8 key)
229{ 229{
230 securityfs_create_file(name, mode, parent, ((u8 *) NULL) + key, 230 securityfs_create_file(name, mode, parent, ((u8 *) NULL) + key,
diff --git a/security/tomoyo/tomoyo.c b/security/tomoyo/tomoyo.c
index 4b327b691745..75c956a51e75 100644
--- a/security/tomoyo/tomoyo.c
+++ b/security/tomoyo/tomoyo.c
@@ -186,7 +186,7 @@ static int tomoyo_path_unlink(struct path *parent, struct dentry *dentry)
186 * Returns 0 on success, negative value otherwise. 186 * Returns 0 on success, negative value otherwise.
187 */ 187 */
188static int tomoyo_path_mkdir(struct path *parent, struct dentry *dentry, 188static int tomoyo_path_mkdir(struct path *parent, struct dentry *dentry,
189 int mode) 189 umode_t mode)
190{ 190{
191 struct path path = { parent->mnt, dentry }; 191 struct path path = { parent->mnt, dentry };
192 return tomoyo_path_number_perm(TOMOYO_TYPE_MKDIR, &path, 192 return tomoyo_path_number_perm(TOMOYO_TYPE_MKDIR, &path,
@@ -234,7 +234,7 @@ static int tomoyo_path_symlink(struct path *parent, struct dentry *dentry,
234 * Returns 0 on success, negative value otherwise. 234 * Returns 0 on success, negative value otherwise.
235 */ 235 */
236static int tomoyo_path_mknod(struct path *parent, struct dentry *dentry, 236static int tomoyo_path_mknod(struct path *parent, struct dentry *dentry,
237 int mode, unsigned int dev) 237 umode_t mode, unsigned int dev)
238{ 238{
239 struct path path = { parent->mnt, dentry }; 239 struct path path = { parent->mnt, dentry };
240 int type = TOMOYO_TYPE_CREATE; 240 int type = TOMOYO_TYPE_CREATE;
@@ -360,7 +360,7 @@ static int tomoyo_file_ioctl(struct file *file, unsigned int cmd,
360 * Returns 0 on success, negative value otherwise. 360 * Returns 0 on success, negative value otherwise.
361 */ 361 */
362static int tomoyo_path_chmod(struct dentry *dentry, struct vfsmount *mnt, 362static int tomoyo_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
363 mode_t mode) 363 umode_t mode)
364{ 364{
365 struct path path = { mnt, dentry }; 365 struct path path = { mnt, dentry };
366 return tomoyo_path_number_perm(TOMOYO_TYPE_CHMOD, &path, 366 return tomoyo_path_number_perm(TOMOYO_TYPE_CHMOD, &path,
diff --git a/sound/sound_core.c b/sound/sound_core.c
index 6ce277860fd7..c6e81fb928e9 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -29,7 +29,7 @@ MODULE_DESCRIPTION("Core sound module");
29MODULE_AUTHOR("Alan Cox"); 29MODULE_AUTHOR("Alan Cox");
30MODULE_LICENSE("GPL"); 30MODULE_LICENSE("GPL");
31 31
32static char *sound_devnode(struct device *dev, mode_t *mode) 32static char *sound_devnode(struct device *dev, umode_t *mode)
33{ 33{
34 if (MAJOR(dev->devt) == SOUND_MAJOR) 34 if (MAJOR(dev->devt) == SOUND_MAJOR)
35 return NULL; 35 return NULL;