aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/vfs_file.c1
-rw-r--r--fs/adfs/adfs.h1
-rw-r--r--fs/binfmt_misc.c2
-rw-r--r--fs/compat_ioctl.c153
-rw-r--r--fs/exec.c16
-rw-r--r--fs/ext2/CHANGES157
-rw-r--r--fs/ext2/balloc.c73
-rw-r--r--fs/ext2/ialloc.c40
-rw-r--r--fs/ext2/super.c16
-rw-r--r--fs/ext3/balloc.c73
-rw-r--r--fs/ext3/ialloc.c41
-rw-r--r--fs/ext3/super.c17
-rw-r--r--fs/fat/inode.c11
-rw-r--r--fs/hfs/hfs_fs.h1
-rw-r--r--fs/hfs/inode.c1
-rw-r--r--fs/hfsplus/bnode.c1
-rw-r--r--fs/hfsplus/dir.c1
-rw-r--r--fs/hfsplus/extents.c1
-rw-r--r--fs/hfsplus/hfsplus_fs.h1
-rw-r--r--fs/hfsplus/inode.c1
-rw-r--r--fs/hfsplus/super.c1
-rw-r--r--fs/hfsplus/wrapper.c1
-rw-r--r--fs/hostfs/hostfs_kern.c1
-rw-r--r--fs/hpfs/file.c7
-rw-r--r--fs/hugetlbfs/inode.c2
-rw-r--r--fs/inotify.c2
-rw-r--r--fs/jfs/namei.c3
-rw-r--r--fs/namei.c66
-rw-r--r--fs/namespace.c2
-rw-r--r--fs/ncpfs/ioctl.c34
-rw-r--r--fs/open.c14
-rw-r--r--fs/reiserfs/file.c4
-rw-r--r--fs/udf/file.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_linux.h1
-rw-r--r--fs/xfs/xfs.h7
-rw-r--r--fs/xfs/xfs_dmapi.h1
36 files changed, 118 insertions, 638 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index bbc3cc63854..89c849da850 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -32,7 +32,6 @@
32#include <linux/string.h> 32#include <linux/string.h>
33#include <linux/smp_lock.h> 33#include <linux/smp_lock.h>
34#include <linux/inet.h> 34#include <linux/inet.h>
35#include <linux/version.h>
36#include <linux/list.h> 35#include <linux/list.h>
37#include <asm/uaccess.h> 36#include <asm/uaccess.h>
38#include <linux/idr.h> 37#include <linux/idr.h>
diff --git a/fs/adfs/adfs.h b/fs/adfs/adfs.h
index fd528433de4..f6cd01352cc 100644
--- a/fs/adfs/adfs.h
+++ b/fs/adfs/adfs.h
@@ -12,7 +12,6 @@
12#define ADFS_NDA_PUBLIC_READ (1 << 5) 12#define ADFS_NDA_PUBLIC_READ (1 << 5)
13#define ADFS_NDA_PUBLIC_WRITE (1 << 6) 13#define ADFS_NDA_PUBLIC_WRITE (1 << 6)
14 14
15#include <linux/version.h>
16#include "dir_f.h" 15#include "dir_f.h"
17 16
18struct buffer_head; 17struct buffer_head;
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 8ae0db6cd69..2568eb41cb3 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -150,7 +150,7 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs)
150 150
151 /* if the binary is not readable than enforce mm->dumpable=0 151 /* if the binary is not readable than enforce mm->dumpable=0
152 regardless of the interpreter's permissions */ 152 regardless of the interpreter's permissions */
153 if (permission(bprm->file->f_dentry->d_inode, MAY_READ, NULL)) 153 if (file_permission(bprm->file, MAY_READ))
154 bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP; 154 bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP;
155 155
156 allow_write_access(bprm->file); 156 allow_write_access(bprm->file);
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 4909754ea84..26300fccb4f 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -840,146 +840,6 @@ static int hdio_getgeo(unsigned int fd, unsigned int cmd, unsigned long arg)
840 return err ? -EFAULT : 0; 840 return err ? -EFAULT : 0;
841} 841}
842 842
843struct fb_fix_screeninfo32 {
844 char id[16];
845 compat_caddr_t smem_start;
846 u32 smem_len;
847 u32 type;
848 u32 type_aux;
849 u32 visual;
850 u16 xpanstep;
851 u16 ypanstep;
852 u16 ywrapstep;
853 u32 line_length;
854 compat_caddr_t mmio_start;
855 u32 mmio_len;
856 u32 accel;
857 u16 reserved[3];
858};
859
860struct fb_cmap32 {
861 u32 start;
862 u32 len;
863 compat_caddr_t red;
864 compat_caddr_t green;
865 compat_caddr_t blue;
866 compat_caddr_t transp;
867};
868
869static int fb_getput_cmap(unsigned int fd, unsigned int cmd, unsigned long arg)
870{
871 struct fb_cmap_user __user *cmap;
872 struct fb_cmap32 __user *cmap32;
873 __u32 data;
874 int err;
875
876 cmap = compat_alloc_user_space(sizeof(*cmap));
877 cmap32 = compat_ptr(arg);
878
879 if (copy_in_user(&cmap->start, &cmap32->start, 2 * sizeof(__u32)))
880 return -EFAULT;
881
882 if (get_user(data, &cmap32->red) ||
883 put_user(compat_ptr(data), &cmap->red) ||
884 get_user(data, &cmap32->green) ||
885 put_user(compat_ptr(data), &cmap->green) ||
886 get_user(data, &cmap32->blue) ||
887 put_user(compat_ptr(data), &cmap->blue) ||
888 get_user(data, &cmap32->transp) ||
889 put_user(compat_ptr(data), &cmap->transp))
890 return -EFAULT;
891
892 err = sys_ioctl(fd, cmd, (unsigned long) cmap);
893
894 if (!err) {
895 if (copy_in_user(&cmap32->start,
896 &cmap->start,
897 2 * sizeof(__u32)))
898 err = -EFAULT;
899 }
900 return err;
901}
902
903static int do_fscreeninfo_to_user(struct fb_fix_screeninfo *fix,
904 struct fb_fix_screeninfo32 __user *fix32)
905{
906 __u32 data;
907 int err;
908
909 err = copy_to_user(&fix32->id, &fix->id, sizeof(fix32->id));
910
911 data = (__u32) (unsigned long) fix->smem_start;
912 err |= put_user(data, &fix32->smem_start);
913
914 err |= put_user(fix->smem_len, &fix32->smem_len);
915 err |= put_user(fix->type, &fix32->type);
916 err |= put_user(fix->type_aux, &fix32->type_aux);
917 err |= put_user(fix->visual, &fix32->visual);
918 err |= put_user(fix->xpanstep, &fix32->xpanstep);
919 err |= put_user(fix->ypanstep, &fix32->ypanstep);
920 err |= put_user(fix->ywrapstep, &fix32->ywrapstep);
921 err |= put_user(fix->line_length, &fix32->line_length);
922
923 data = (__u32) (unsigned long) fix->mmio_start;
924 err |= put_user(data, &fix32->mmio_start);
925
926 err |= put_user(fix->mmio_len, &fix32->mmio_len);
927 err |= put_user(fix->accel, &fix32->accel);
928 err |= copy_to_user(fix32->reserved, fix->reserved,
929 sizeof(fix->reserved));
930
931 return err;
932}
933
934static int fb_get_fscreeninfo(unsigned int fd, unsigned int cmd, unsigned long arg)
935{
936 mm_segment_t old_fs;
937 struct fb_fix_screeninfo fix;
938 struct fb_fix_screeninfo32 __user *fix32;
939 int err;
940
941 fix32 = compat_ptr(arg);
942
943 old_fs = get_fs();
944 set_fs(KERNEL_DS);
945 err = sys_ioctl(fd, cmd, (unsigned long) &fix);
946 set_fs(old_fs);
947
948 if (!err)
949 err = do_fscreeninfo_to_user(&fix, fix32);
950
951 return err;
952}
953
954static int fb_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
955{
956 int err;
957
958 switch (cmd) {
959 case FBIOGET_FSCREENINFO:
960 err = fb_get_fscreeninfo(fd,cmd, arg);
961 break;
962
963 case FBIOGETCMAP:
964 case FBIOPUTCMAP:
965 err = fb_getput_cmap(fd, cmd, arg);
966 break;
967
968 default:
969 do {
970 static int count;
971 if (++count <= 20)
972 printk("%s: Unknown fb ioctl cmd fd(%d) "
973 "cmd(%08x) arg(%08lx)\n",
974 __FUNCTION__, fd, cmd, arg);
975 } while(0);
976 err = -ENOSYS;
977 break;
978 };
979
980 return err;
981}
982
983static int hdio_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) 843static int hdio_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
984{ 844{
985 mm_segment_t old_fs = get_fs(); 845 mm_segment_t old_fs = get_fs();
@@ -2953,10 +2813,7 @@ HANDLE_IOCTL(BLKGETSIZE, w_long)
2953HANDLE_IOCTL(0x1260, broken_blkgetsize) 2813HANDLE_IOCTL(0x1260, broken_blkgetsize)
2954HANDLE_IOCTL(BLKFRAGET, w_long) 2814HANDLE_IOCTL(BLKFRAGET, w_long)
2955HANDLE_IOCTL(BLKSECTGET, w_long) 2815HANDLE_IOCTL(BLKSECTGET, w_long)
2956HANDLE_IOCTL(FBIOGET_FSCREENINFO, fb_ioctl_trans)
2957HANDLE_IOCTL(BLKPG, blkpg_ioctl_trans) 2816HANDLE_IOCTL(BLKPG, blkpg_ioctl_trans)
2958HANDLE_IOCTL(FBIOGETCMAP, fb_ioctl_trans)
2959HANDLE_IOCTL(FBIOPUTCMAP, fb_ioctl_trans)
2960HANDLE_IOCTL(HDIO_GET_KEEPSETTINGS, hdio_ioctl_trans) 2817HANDLE_IOCTL(HDIO_GET_KEEPSETTINGS, hdio_ioctl_trans)
2961HANDLE_IOCTL(HDIO_GET_UNMASKINTR, hdio_ioctl_trans) 2818HANDLE_IOCTL(HDIO_GET_UNMASKINTR, hdio_ioctl_trans)
2962HANDLE_IOCTL(HDIO_GET_DMA, hdio_ioctl_trans) 2819HANDLE_IOCTL(HDIO_GET_DMA, hdio_ioctl_trans)
@@ -3051,6 +2908,16 @@ HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl)
3051COMPATIBLE_IOCTL(TIOCGLTC) 2908COMPATIBLE_IOCTL(TIOCGLTC)
3052COMPATIBLE_IOCTL(TIOCSLTC) 2909COMPATIBLE_IOCTL(TIOCSLTC)
3053#endif 2910#endif
2911#ifdef TIOCSTART
2912/*
2913 * For these two we have defintions in ioctls.h and/or termios.h on
2914 * some architectures but no actual implemention. Some applications
2915 * like bash call them if they are defined in the headers, so we provide
2916 * entries here to avoid syslog message spew.
2917 */
2918COMPATIBLE_IOCTL(TIOCSTART)
2919COMPATIBLE_IOCTL(TIOCSTOP)
2920#endif
3054/* Usbdevfs */ 2921/* Usbdevfs */
3055HANDLE_IOCTL(USBDEVFS_CONTROL32, do_usbdevfs_control) 2922HANDLE_IOCTL(USBDEVFS_CONTROL32, do_usbdevfs_control)
3056HANDLE_IOCTL(USBDEVFS_BULK32, do_usbdevfs_bulk) 2923HANDLE_IOCTL(USBDEVFS_BULK32, do_usbdevfs_bulk)
diff --git a/fs/exec.c b/fs/exec.c
index cd6c574557d..c466fec5de2 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -135,7 +135,7 @@ asmlinkage long sys_uselib(const char __user * library)
135 if (!S_ISREG(nd.dentry->d_inode->i_mode)) 135 if (!S_ISREG(nd.dentry->d_inode->i_mode))
136 goto exit; 136 goto exit;
137 137
138 error = permission(nd.dentry->d_inode, MAY_READ | MAY_EXEC, &nd); 138 error = vfs_permission(&nd, MAY_READ | MAY_EXEC);
139 if (error) 139 if (error)
140 goto exit; 140 goto exit;
141 141
@@ -495,7 +495,7 @@ struct file *open_exec(const char *name)
495 file = ERR_PTR(-EACCES); 495 file = ERR_PTR(-EACCES);
496 if (!(nd.mnt->mnt_flags & MNT_NOEXEC) && 496 if (!(nd.mnt->mnt_flags & MNT_NOEXEC) &&
497 S_ISREG(inode->i_mode)) { 497 S_ISREG(inode->i_mode)) {
498 int err = permission(inode, MAY_EXEC, &nd); 498 int err = vfs_permission(&nd, MAY_EXEC);
499 if (!err && !(inode->i_mode & 0111)) 499 if (!err && !(inode->i_mode & 0111))
500 err = -EACCES; 500 err = -EACCES;
501 file = ERR_PTR(err); 501 file = ERR_PTR(err);
@@ -590,6 +590,7 @@ static inline int de_thread(struct task_struct *tsk)
590 struct signal_struct *sig = tsk->signal; 590 struct signal_struct *sig = tsk->signal;
591 struct sighand_struct *newsighand, *oldsighand = tsk->sighand; 591 struct sighand_struct *newsighand, *oldsighand = tsk->sighand;
592 spinlock_t *lock = &oldsighand->siglock; 592 spinlock_t *lock = &oldsighand->siglock;
593 struct task_struct *leader = NULL;
593 int count; 594 int count;
594 595
595 /* 596 /*
@@ -665,7 +666,7 @@ static inline int de_thread(struct task_struct *tsk)
665 * and to assume its PID: 666 * and to assume its PID:
666 */ 667 */
667 if (!thread_group_leader(current)) { 668 if (!thread_group_leader(current)) {
668 struct task_struct *leader = current->group_leader, *parent; 669 struct task_struct *parent;
669 struct dentry *proc_dentry1, *proc_dentry2; 670 struct dentry *proc_dentry1, *proc_dentry2;
670 unsigned long exit_state, ptrace; 671 unsigned long exit_state, ptrace;
671 672
@@ -674,6 +675,7 @@ static inline int de_thread(struct task_struct *tsk)
674 * It should already be zombie at this point, most 675 * It should already be zombie at this point, most
675 * of the time. 676 * of the time.
676 */ 677 */
678 leader = current->group_leader;
677 while (leader->exit_state != EXIT_ZOMBIE) 679 while (leader->exit_state != EXIT_ZOMBIE)
678 yield(); 680 yield();
679 681
@@ -733,7 +735,6 @@ static inline int de_thread(struct task_struct *tsk)
733 proc_pid_flush(proc_dentry2); 735 proc_pid_flush(proc_dentry2);
734 736
735 BUG_ON(exit_state != EXIT_ZOMBIE); 737 BUG_ON(exit_state != EXIT_ZOMBIE);
736 release_task(leader);
737 } 738 }
738 739
739 /* 740 /*
@@ -743,8 +744,11 @@ static inline int de_thread(struct task_struct *tsk)
743 sig->flags = 0; 744 sig->flags = 0;
744 745
745no_thread_group: 746no_thread_group:
746 BUG_ON(atomic_read(&sig->count) != 1);
747 exit_itimers(sig); 747 exit_itimers(sig);
748 if (leader)
749 release_task(leader);
750
751 BUG_ON(atomic_read(&sig->count) != 1);
748 752
749 if (atomic_read(&oldsighand->count) == 1) { 753 if (atomic_read(&oldsighand->count) == 1) {
750 /* 754 /*
@@ -892,7 +896,7 @@ int flush_old_exec(struct linux_binprm * bprm)
892 flush_thread(); 896 flush_thread();
893 897
894 if (bprm->e_uid != current->euid || bprm->e_gid != current->egid || 898 if (bprm->e_uid != current->euid || bprm->e_gid != current->egid ||
895 permission(bprm->file->f_dentry->d_inode,MAY_READ, NULL) || 899 file_permission(bprm->file, MAY_READ) ||
896 (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) { 900 (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) {
897 suid_keys(current); 901 suid_keys(current);
898 current->mm->dumpable = suid_dumpable; 902 current->mm->dumpable = suid_dumpable;
diff --git a/fs/ext2/CHANGES b/fs/ext2/CHANGES
deleted file mode 100644
index aa5aaf0e591..00000000000
--- a/fs/ext2/CHANGES
+++ /dev/null
@@ -1,157 +0,0 @@
1Changes from version 0.5a to version 0.5b
2=========================================
3 - Now that we have sysctl(), the immutable flag cannot be changed when
4 the system is running at security level > 0.
5 - Some cleanups in the code.
6 - More consistency checks on directories.
7 - The ext2.diff patch from Tom May <ftom@netcom.com> has been
8 integrated. This patch replaces expensive "/" and "%" with
9 cheap ">>" and "&" where possible.
10
11Changes from version 0.5 to version 0.5a
12========================================
13 - Zero the partial block following the end of the file when a file
14 is truncated.
15 - Dates updated in the copyright.
16 - More checks when the filesystem is mounted: the count of blocks,
17 fragments, and inodes per group is checked against the block size.
18 - The buffers used by the error routines are now static variables, to
19 avoid using space on the kernel stack, as requested by Linus.
20 - Some cleanups in the error messages (some versions of syslog contain
21 a bug which truncates an error message if it contains '\n').
22 - Check that no data can be written to a file past the 2GB limit.
23 - The famous readdir() bug has been fixed by Stephen Tweedie.
24 - Added a revision level in the superblock.
25 - Full support for O_SYNC flag of the open system call.
26 - New mount options: `resuid=#uid' and `resgid=#gid'. `resuid' causes
27 ext2fs to consider user #uid like root for the reserved blocks.
28 `resgid' acts the same way with group #gid. New fields in the
29 superblock contain default values for resuid and resgid and can
30 be modified by tune2fs.
31 Idea comes from Rene Cougnenc <cougnenc@renux.frmug.fr.net>.
32 - New mount options: `bsddf' and `minixdf'. `bsddf' causes ext2fs
33 to remove the blocks used for FS structures from the total block
34 count in statfs. With `minixdf', ext2fs mimics Minix behavior
35 in statfs (i.e. it returns the total number of blocks on the
36 partition). This is intended to make bde happy :-)
37 - New file attributes:
38 - Immutable files cannot be modified. Data cannot be written to
39 these files. They cannot be removed, renamed and new links cannot
40 be created. Even root cannot modify the files. He has to remove
41 the immutable attribute first.
42 - Append-only files: can only be written in append-mode when writing.
43 They cannot be removed, renamed and new links cannot be created.
44 Note: files may only be added to an append-only directory.
45 - No-dump files: the attribute is not used by the kernel. My port
46 of dump uses it to avoid backing up files which are not important.
47 - New check in ext2_check_dir_entry: the inode number is checked.
48 - Support for big file systems: the copy of the FS descriptor is now
49 dynamically allocated (previous versions used a fixed size array).
50 This allows to mount 2GB+ FS.
51 - Reorganization of the ext2_inode structure to allow other operating
52 systems to create specific fields if they use ext2fs as their native
53 file system. Currently, ext2fs is only implemented in Linux but
54 will soon be part of Gnu Hurd and of Masix.
55
56Changes from version 0.4b to version 0.5
57========================================
58 - New superblock fields: s_lastcheck and s_checkinterval added
59 by Uwe Ohse <uwe@tirka.gun.de> to implement timedependent checks
60 of the file system
61 - Real random numbers for secure rm added by Pierre del Perugia
62 <delperug@gla.ecoledoc.ibp.fr>
63 - The mount warnings related to the state of a fs are not printed
64 if the fs is mounted read-only, idea by Nick Holloway
65 <alfie@dcs.warwick.ac.uk>
66
67Changes from version 0.4a to version 0.4b
68=========================================
69 - Copyrights changed to include the name of my laboratory.
70 - Clean up of balloc.c and ialloc.c.
71 - More consistency checks.
72 - Block preallocation added by Stephen Tweedie.
73 - Direct reads of directories disallowed.
74 - Readahead implemented in readdir by Stephen Tweedie.
75 - Bugs in block and inodes allocation fixed.
76 - Readahead implemented in ext2_find_entry by Chip Salzenberg.
77 - New mount options:
78 `check=none|normal|strict'
79 `debug'
80 `errors=continue|remount-ro|panic'
81 `grpid', `bsdgroups'
82 `nocheck'
83 `nogrpid', `sysvgroups'
84 - truncate() now tries to deallocate contiguous blocks in a single call
85 to ext2_free_blocks().
86 - lots of cosmetic changes.
87
88Changes from version 0.4 to version 0.4a
89========================================
90 - the `sync' option support is now complete. Version 0.4 was not
91 supporting it when truncating a file. I have tested the synchronous
92 writes and they work but they make the system very slow :-( I have
93 to work again on this to make it faster.
94 - when detecting an error on a mounted filesystem, version 0.4 used
95 to try to write a flag in the super block even if the filesystem had
96 been mounted read-only. This is fixed.
97 - the `sb=#' option now causes the kernel code to use the filesystem
98 descriptors located at block #+1. Version 0.4 used the superblock
99 backup located at block # but used the main copy of the descriptors.
100 - a new file attribute `S' is supported. This attribute causes
101 synchronous writes but is applied to a file not to the entire file
102 system (thanks to Michael Kraehe <kraehe@bakunin.north.de> for
103 suggesting it).
104 - the directory cache is inhibited by default. The cache management
105 code seems to be buggy and I have to look at it carefully before
106 using it again.
107 - deleting a file with the `s' attribute (secure deletion) causes its
108 blocks to be overwritten with random values not with zeros (thanks to
109 Michael A. Griffith <grif@cs.ucr.edu> for suggesting it).
110 - lots of cosmetic changes have been made.
111
112Changes from version 0.3 to version 0.4
113=======================================
114 - Three new mount options are supported: `check', `sync' and `sb=#'.
115 `check' tells the kernel code to make more consistency checks
116 when the file system is mounted. Currently, the kernel code checks
117 that the blocks and inodes bitmaps are consistent with the free
118 blocks and inodes counts. More checks will be added in future
119 releases.
120 `sync' tells the kernel code to use synchronous writes when updating
121 an inode, a bitmap, a directory entry or an indirect block. This
122 can make the file system much slower but can be a big win for files
123 recovery in case of a crash (and we can now say to the BSD folks
124 that Linux also supports synchronous updates :-).
125 `sb=#' tells the kernel code to use an alternate super block instead
126 of its master copy. `#' is the number of the block (counted in
127 1024 bytes blocks) which contains the alternate super block.
128 An ext2 file system typically contains backups of the super block
129 at blocks 8193, 16385, and so on.
130 - I have change the meaning of the valid flag used by e2fsck. it
131 now contains the state of the file system. If the kernel code
132 detects an inconsistency while the file system is mounted, it flags
133 it as erroneous and e2fsck will detect that on next run.
134 - The super block now contains a mount counter. This counter is
135 incremented each time the file system is mounted read/write. When
136 this counter becomes bigger than a maximal mount counts (also stored
137 in the super block), e2fsck checks the file system, even if it had
138 been unmounted cleanly, and resets this counter to 0.
139 - File attributes are now supported. One can associate a set of
140 attributes to a file. Three attributes are defined:
141 `c': the file is marked for automatic compression,
142 `s': the file is marked for secure deletion: when the file is
143 deleted, its blocks are zeroed and written back to the disk,
144 `u': the file is marked for undeletion: when the file is deleted,
145 its contents are saved to allow a future undeletion.
146 Currently, only the `s' attribute is implemented in the kernel
147 code. Support for the other attributes will be added in a future
148 release.
149 - a few bugs related to times updates have been fixed by Bruce
150 Evans and me.
151 - a bug related to the links count of deleted inodes has been fixed.
152 Previous versions used to keep the links count set to 1 when a file
153 was deleted. The new version now sets links_count to 0 when deleting
154 the last link.
155 - a race condition when deallocating an inode has been fixed by
156 Stephen Tweedie.
157
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index 6591abef64d..bb690806649 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -624,76 +624,3 @@ unsigned long ext2_bg_num_gdb(struct super_block *sb, int group)
624 return EXT2_SB(sb)->s_gdb_count; 624 return EXT2_SB(sb)->s_gdb_count;
625} 625}
626 626
627#ifdef CONFIG_EXT2_CHECK
628/* Called at mount-time, super-block is locked */
629void ext2_check_blocks_bitmap (struct super_block * sb)
630{
631 struct buffer_head *bitmap_bh = NULL;
632 struct ext2_super_block * es;
633 unsigned long desc_count, bitmap_count, x, j;
634 unsigned long desc_blocks;
635 struct ext2_group_desc * desc;
636 int i;
637
638 es = EXT2_SB(sb)->s_es;
639 desc_count = 0;
640 bitmap_count = 0;
641 desc = NULL;
642 for (i = 0; i < EXT2_SB(sb)->s_groups_count; i++) {
643 desc = ext2_get_group_desc (sb, i, NULL);
644 if (!desc)
645 continue;
646 desc_count += le16_to_cpu(desc->bg_free_blocks_count);
647 brelse(bitmap_bh);
648 bitmap_bh = read_block_bitmap(sb, i);
649 if (!bitmap_bh)
650 continue;
651
652 if (ext2_bg_has_super(sb, i) &&
653 !ext2_test_bit(0, bitmap_bh->b_data))
654 ext2_error(sb, __FUNCTION__,
655 "Superblock in group %d is marked free", i);
656
657 desc_blocks = ext2_bg_num_gdb(sb, i);
658 for (j = 0; j < desc_blocks; j++)
659 if (!ext2_test_bit(j + 1, bitmap_bh->b_data))
660 ext2_error(sb, __FUNCTION__,
661 "Descriptor block #%ld in group "
662 "%d is marked free", j, i);
663
664 if (!block_in_use(le32_to_cpu(desc->bg_block_bitmap),
665 sb, bitmap_bh->b_data))
666 ext2_error(sb, "ext2_check_blocks_bitmap",
667 "Block bitmap for group %d is marked free",
668 i);
669
670 if (!block_in_use(le32_to_cpu(desc->bg_inode_bitmap),
671 sb, bitmap_bh->b_data))
672 ext2_error(sb, "ext2_check_blocks_bitmap",
673 "Inode bitmap for group %d is marked free",
674 i);
675
676 for (j = 0; j < EXT2_SB(sb)->s_itb_per_group; j++)
677 if (!block_in_use(le32_to_cpu(desc->bg_inode_table) + j,
678 sb, bitmap_bh->b_data))
679 ext2_error (sb, "ext2_check_blocks_bitmap",
680 "Block #%ld of the inode table in "
681 "group %d is marked free", j, i);
682
683 x = ext2_count_free(bitmap_bh, sb->s_blocksize);
684 if (le16_to_cpu(desc->bg_free_blocks_count) != x)
685 ext2_error (sb, "ext2_check_blocks_bitmap",
686 "Wrong free blocks count for group %d, "
687 "stored = %d, counted = %lu", i,
688 le16_to_cpu(desc->bg_free_blocks_count), x);
689 bitmap_count += x;
690 }
691 if (le32_to_cpu(es->s_free_blocks_count) != bitmap_count)
692 ext2_error (sb, "ext2_check_blocks_bitmap",
693 "Wrong free blocks count in super block, "
694 "stored = %lu, counted = %lu",
695 (unsigned long)le32_to_cpu(es->s_free_blocks_count),
696 bitmap_count);
697 brelse(bitmap_bh);
698}
699#endif
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index e2d6208633a..74714af4ae6 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -700,43 +700,3 @@ unsigned long ext2_count_dirs (struct super_block * sb)
700 return count; 700 return count;
701} 701}
702 702
703#ifdef CONFIG_EXT2_CHECK
704/* Called at mount-time, super-block is locked */
705void ext2_check_inodes_bitmap (struct super_block * sb)
706{
707 struct ext2_super_block * es = EXT2_SB(sb)->s_es;
708 unsigned long desc_count = 0, bitmap_count = 0;
709 struct buffer_head *bitmap_bh = NULL;
710 int i;
711
712 for (i = 0; i < EXT2_SB(sb)->s_groups_count; i++) {
713 struct ext2_group_desc *desc;
714 unsigned x;
715
716 desc = ext2_get_group_desc(sb, i, NULL);
717 if (!desc)
718 continue;
719 desc_count += le16_to_cpu(desc->bg_free_inodes_count);
720 brelse(bitmap_bh);
721 bitmap_bh = read_inode_bitmap(sb, i);
722 if (!bitmap_bh)
723 continue;
724
725 x = ext2_count_free(bitmap_bh, EXT2_INODES_PER_GROUP(sb) / 8);
726 if (le16_to_cpu(desc->bg_free_inodes_count) != x)
727 ext2_error (sb, "ext2_check_inodes_bitmap",
728 "Wrong free inodes count in group %d, "
729 "stored = %d, counted = %lu", i,
730 le16_to_cpu(desc->bg_free_inodes_count), x);
731 bitmap_count += x;
732 }
733 brelse(bitmap_bh);
734 if (percpu_counter_read(&EXT2_SB(sb)->s_freeinodes_counter) !=
735 bitmap_count)
736 ext2_error(sb, "ext2_check_inodes_bitmap",
737 "Wrong free inodes count in super block, "
738 "stored = %lu, counted = %lu",
739 (unsigned long)le32_to_cpu(es->s_free_inodes_count),
740 bitmap_count);
741}
742#endif
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 3c0c7c6a5b4..e4ed4b31a43 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -281,7 +281,7 @@ static unsigned long get_sb_block(void **data)
281enum { 281enum {
282 Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid, 282 Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid,
283 Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, 283 Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic,
284 Opt_err_ro, Opt_nouid32, Opt_check, Opt_nocheck, Opt_debug, 284 Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug,
285 Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr, 285 Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr,
286 Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota, 286 Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota,
287 Opt_usrquota, Opt_grpquota 287 Opt_usrquota, Opt_grpquota
@@ -303,7 +303,6 @@ static match_table_t tokens = {
303 {Opt_nouid32, "nouid32"}, 303 {Opt_nouid32, "nouid32"},
304 {Opt_nocheck, "check=none"}, 304 {Opt_nocheck, "check=none"},
305 {Opt_nocheck, "nocheck"}, 305 {Opt_nocheck, "nocheck"},
306 {Opt_check, "check"},
307 {Opt_debug, "debug"}, 306 {Opt_debug, "debug"},
308 {Opt_oldalloc, "oldalloc"}, 307 {Opt_oldalloc, "oldalloc"},
309 {Opt_orlov, "orlov"}, 308 {Opt_orlov, "orlov"},
@@ -376,13 +375,6 @@ static int parse_options (char * options,
376 case Opt_nouid32: 375 case Opt_nouid32:
377 set_opt (sbi->s_mount_opt, NO_UID32); 376 set_opt (sbi->s_mount_opt, NO_UID32);
378 break; 377 break;
379 case Opt_check:
380#ifdef CONFIG_EXT2_CHECK
381 set_opt (sbi->s_mount_opt, CHECK);
382#else
383 printk("EXT2 Check option not supported\n");
384#endif
385 break;
386 case Opt_nocheck: 378 case Opt_nocheck:
387 clear_opt (sbi->s_mount_opt, CHECK); 379 clear_opt (sbi->s_mount_opt, CHECK);
388 break; 380 break;
@@ -503,12 +495,6 @@ static int ext2_setup_super (struct super_block * sb,
503 EXT2_BLOCKS_PER_GROUP(sb), 495 EXT2_BLOCKS_PER_GROUP(sb),
504 EXT2_INODES_PER_GROUP(sb), 496 EXT2_INODES_PER_GROUP(sb),
505 sbi->s_mount_opt); 497 sbi->s_mount_opt);
506#ifdef CONFIG_EXT2_CHECK
507 if (test_opt (sb, CHECK)) {
508 ext2_check_blocks_bitmap (sb);
509 ext2_check_inodes_bitmap (sb);
510 }
511#endif
512 return res; 498 return res;
513} 499}
514 500
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c
index 7992d21e0e0..ae1148c24c5 100644
--- a/fs/ext3/balloc.c
+++ b/fs/ext3/balloc.c
@@ -1517,76 +1517,3 @@ unsigned long ext3_bg_num_gdb(struct super_block *sb, int group)
1517 return EXT3_SB(sb)->s_gdb_count; 1517 return EXT3_SB(sb)->s_gdb_count;
1518} 1518}
1519 1519
1520#ifdef CONFIG_EXT3_CHECK
1521/* Called at mount-time, super-block is locked */
1522void ext3_check_blocks_bitmap (struct super_block * sb)
1523{
1524 struct ext3_super_block *es;
1525 unsigned long desc_count, bitmap_count, x, j;
1526 unsigned long desc_blocks;
1527 struct buffer_head *bitmap_bh = NULL;
1528 struct ext3_group_desc *gdp;
1529 int i;
1530
1531 es = EXT3_SB(sb)->s_es;
1532 desc_count = 0;
1533 bitmap_count = 0;
1534 gdp = NULL;
1535 for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) {
1536 gdp = ext3_get_group_desc (sb, i, NULL);
1537 if (!gdp)
1538 continue;
1539 desc_count += le16_to_cpu(gdp->bg_free_blocks_count);
1540 brelse(bitmap_bh);
1541 bitmap_bh = read_block_bitmap(sb, i);
1542 if (bitmap_bh == NULL)
1543 continue;
1544
1545 if (ext3_bg_has_super(sb, i) &&
1546 !ext3_test_bit(0, bitmap_bh->b_data))
1547 ext3_error(sb, __FUNCTION__,
1548 "Superblock in group %d is marked free", i);
1549
1550 desc_blocks = ext3_bg_num_gdb(sb, i);
1551 for (j = 0; j < desc_blocks; j++)
1552 if (!ext3_test_bit(j + 1, bitmap_bh->b_data))
1553 ext3_error(sb, __FUNCTION__,
1554 "Descriptor block #%ld in group "
1555 "%d is marked free", j, i);
1556
1557 if (!block_in_use (le32_to_cpu(gdp->bg_block_bitmap),
1558 sb, bitmap_bh->b_data))
1559 ext3_error (sb, "ext3_check_blocks_bitmap",
1560 "Block bitmap for group %d is marked free",
1561 i);
1562
1563 if (!block_in_use (le32_to_cpu(gdp->bg_inode_bitmap),
1564 sb, bitmap_bh->b_data))
1565 ext3_error (sb, "ext3_check_blocks_bitmap",
1566 "Inode bitmap for group %d is marked free",
1567 i);
1568
1569 for (j = 0; j < EXT3_SB(sb)->s_itb_per_group; j++)
1570 if (!block_in_use (le32_to_cpu(gdp->bg_inode_table) + j,
1571 sb, bitmap_bh->b_data))
1572 ext3_error (sb, "ext3_check_blocks_bitmap",
1573 "Block #%d of the inode table in "
1574 "group %d is marked free", j, i);
1575
1576 x = ext3_count_free(bitmap_bh, sb->s_blocksize);
1577 if (le16_to_cpu(gdp->bg_free_blocks_count) != x)
1578 ext3_error (sb, "ext3_check_blocks_bitmap",
1579 "Wrong free blocks count for group %d, "
1580 "stored = %d, counted = %lu", i,
1581 le16_to_cpu(gdp->bg_free_blocks_count), x);
1582 bitmap_count += x;
1583 }
1584 brelse(bitmap_bh);
1585 if (le32_to_cpu(es->s_free_blocks_count) != bitmap_count)
1586 ext3_error (sb, "ext3_check_blocks_bitmap",
1587 "Wrong free blocks count in super block, "
1588 "stored = %lu, counted = %lu",
1589 (unsigned long)le32_to_cpu(es->s_free_blocks_count),
1590 bitmap_count);
1591}
1592#endif
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index df3f517c54a..9e4a2437621 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -756,44 +756,3 @@ unsigned long ext3_count_dirs (struct super_block * sb)
756 return count; 756 return count;
757} 757}
758 758
759#ifdef CONFIG_EXT3_CHECK
760/* Called at mount-time, super-block is locked */
761void ext3_check_inodes_bitmap (struct super_block * sb)
762{
763 struct ext3_super_block * es;
764 unsigned long desc_count, bitmap_count, x;
765 struct buffer_head *bitmap_bh = NULL;
766 struct ext3_group_desc * gdp;
767 int i;
768
769 es = EXT3_SB(sb)->s_es;
770 desc_count = 0;
771 bitmap_count = 0;
772 gdp = NULL;
773 for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) {
774 gdp = ext3_get_group_desc (sb, i, NULL);
775 if (!gdp)
776 continue;
777 desc_count += le16_to_cpu(gdp->bg_free_inodes_count);
778 brelse(bitmap_bh);
779 bitmap_bh = read_inode_bitmap(sb, i);
780 if (!bitmap_bh)
781 continue;
782
783 x = ext3_count_free(bitmap_bh, EXT3_INODES_PER_GROUP(sb) / 8);
784 if (le16_to_cpu(gdp->bg_free_inodes_count) != x)
785 ext3_error (sb, "ext3_check_inodes_bitmap",
786 "Wrong free inodes count in group %d, "
787 "stored = %d, counted = %lu", i,
788 le16_to_cpu(gdp->bg_free_inodes_count), x);
789 bitmap_count += x;
790 }
791 brelse(bitmap_bh);
792 if (le32_to_cpu(es->s_free_inodes_count) != bitmap_count)
793 ext3_error (sb, "ext3_check_inodes_bitmap",
794 "Wrong free inodes count in super block, "
795 "stored = %lu, counted = %lu",
796 (unsigned long)le32_to_cpu(es->s_free_inodes_count),
797 bitmap_count);
798}
799#endif
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index f594989ccb7..4e6730622d9 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -625,7 +625,7 @@ static struct export_operations ext3_export_ops = {
625enum { 625enum {
626 Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid, 626 Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid,
627 Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, Opt_err_ro, 627 Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, Opt_err_ro,
628 Opt_nouid32, Opt_check, Opt_nocheck, Opt_debug, Opt_oldalloc, Opt_orlov, 628 Opt_nouid32, Opt_nocheck, Opt_debug, Opt_oldalloc, Opt_orlov,
629 Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, 629 Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl,
630 Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh, 630 Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh,
631 Opt_commit, Opt_journal_update, Opt_journal_inum, 631 Opt_commit, Opt_journal_update, Opt_journal_inum,
@@ -652,7 +652,6 @@ static match_table_t tokens = {
652 {Opt_nouid32, "nouid32"}, 652 {Opt_nouid32, "nouid32"},
653 {Opt_nocheck, "nocheck"}, 653 {Opt_nocheck, "nocheck"},
654 {Opt_nocheck, "check=none"}, 654 {Opt_nocheck, "check=none"},
655 {Opt_check, "check"},
656 {Opt_debug, "debug"}, 655 {Opt_debug, "debug"},
657 {Opt_oldalloc, "oldalloc"}, 656 {Opt_oldalloc, "oldalloc"},
658 {Opt_orlov, "orlov"}, 657 {Opt_orlov, "orlov"},
@@ -773,14 +772,6 @@ static int parse_options (char * options, struct super_block *sb,
773 case Opt_nouid32: 772 case Opt_nouid32:
774 set_opt (sbi->s_mount_opt, NO_UID32); 773 set_opt (sbi->s_mount_opt, NO_UID32);
775 break; 774 break;
776 case Opt_check:
777#ifdef CONFIG_EXT3_CHECK
778 set_opt (sbi->s_mount_opt, CHECK);
779#else
780 printk(KERN_ERR
781 "EXT3 Check option not supported\n");
782#endif
783 break;
784 case Opt_nocheck: 775 case Opt_nocheck:
785 clear_opt (sbi->s_mount_opt, CHECK); 776 clear_opt (sbi->s_mount_opt, CHECK);
786 break; 777 break;
@@ -1115,12 +1106,6 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
1115 } else { 1106 } else {
1116 printk("internal journal\n"); 1107 printk("internal journal\n");
1117 } 1108 }
1118#ifdef CONFIG_EXT3_CHECK
1119 if (test_opt (sb, CHECK)) {
1120 ext3_check_blocks_bitmap (sb);
1121 ext3_check_inodes_bitmap (sb);
1122 }
1123#endif
1124 return res; 1109 return res;
1125} 1110}
1126 1111
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index e2effe2dc9b..a0f9b9fe130 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -846,7 +846,7 @@ static match_table_t vfat_tokens = {
846 {Opt_err, NULL} 846 {Opt_err, NULL}
847}; 847};
848 848
849static int parse_options(char *options, int is_vfat, int *debug, 849static int parse_options(char *options, int is_vfat, int silent, int *debug,
850 struct fat_mount_options *opts) 850 struct fat_mount_options *opts)
851{ 851{
852 char *p; 852 char *p;
@@ -1008,8 +1008,11 @@ static int parse_options(char *options, int is_vfat, int *debug,
1008 break; 1008 break;
1009 /* unknown option */ 1009 /* unknown option */
1010 default: 1010 default:
1011 printk(KERN_ERR "FAT: Unrecognized mount option \"%s\" " 1011 if (!silent) {
1012 "or missing value\n", p); 1012 printk(KERN_ERR
1013 "FAT: Unrecognized mount option \"%s\" "
1014 "or missing value\n", p);
1015 }
1013 return -EINVAL; 1016 return -EINVAL;
1014 } 1017 }
1015 } 1018 }
@@ -1091,7 +1094,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
1091 sb->s_export_op = &fat_export_ops; 1094 sb->s_export_op = &fat_export_ops;
1092 sbi->dir_ops = fs_dir_inode_ops; 1095 sbi->dir_ops = fs_dir_inode_ops;
1093 1096
1094 error = parse_options(data, isvfat, &debug, &sbi->options); 1097 error = parse_options(data, isvfat, silent, &debug, &sbi->options);
1095 if (error) 1098 if (error)
1096 goto out_fail; 1099 goto out_fail;
1097 1100
diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h
index aae019aadf8..cc5dcd52e23 100644
--- a/fs/hfs/hfs_fs.h
+++ b/fs/hfs/hfs_fs.h
@@ -9,7 +9,6 @@
9#ifndef _LINUX_HFS_FS_H 9#ifndef _LINUX_HFS_FS_H
10#define _LINUX_HFS_FS_H 10#define _LINUX_HFS_FS_H
11 11
12#include <linux/version.h>
13#include <linux/slab.h> 12#include <linux/slab.h>
14#include <linux/types.h> 13#include <linux/types.h>
15#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 3f680c5675b..d499393a8ae 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -12,7 +12,6 @@
12 */ 12 */
13 13
14#include <linux/pagemap.h> 14#include <linux/pagemap.h>
15#include <linux/version.h>
16#include <linux/mpage.h> 15#include <linux/mpage.h>
17 16
18#include "hfs_fs.h" 17#include "hfs_fs.h"
diff --git a/fs/hfsplus/bnode.c b/fs/hfsplus/bnode.c
index b85abc6e6f8..930cd9212de 100644
--- a/fs/hfsplus/bnode.c
+++ b/fs/hfsplus/bnode.c
@@ -13,7 +13,6 @@
13#include <linux/pagemap.h> 13#include <linux/pagemap.h>
14#include <linux/fs.h> 14#include <linux/fs.h>
15#include <linux/swap.h> 15#include <linux/swap.h>
16#include <linux/version.h>
17 16
18#include "hfsplus_fs.h" 17#include "hfsplus_fs.h"
19#include "hfsplus_raw.h" 18#include "hfsplus_raw.h"
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 7bda76667a4..50c8f44b6c6 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -13,7 +13,6 @@
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/random.h> 15#include <linux/random.h>
16#include <linux/version.h>
17 16
18#include "hfsplus_fs.h" 17#include "hfsplus_fs.h"
19#include "hfsplus_raw.h" 18#include "hfsplus_raw.h"
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c
index e7235ca79a9..e3ff56a0301 100644
--- a/fs/hfsplus/extents.c
+++ b/fs/hfsplus/extents.c
@@ -11,7 +11,6 @@
11#include <linux/errno.h> 11#include <linux/errno.h>
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/pagemap.h> 13#include <linux/pagemap.h>
14#include <linux/version.h>
15 14
16#include "hfsplus_fs.h" 15#include "hfsplus_fs.h"
17#include "hfsplus_raw.h" 16#include "hfsplus_raw.h"
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index 2bc0cdd30e5..c60e5635498 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -11,7 +11,6 @@
11#define _LINUX_HFSPLUS_FS_H 11#define _LINUX_HFSPLUS_FS_H
12 12
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/version.h>
15#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
16#include "hfsplus_raw.h" 15#include "hfsplus_raw.h"
17 16
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index f205773ddfb..fc98583cf04 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -11,7 +11,6 @@
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/pagemap.h> 13#include <linux/pagemap.h>
14#include <linux/version.h>
15#include <linux/mpage.h> 14#include <linux/mpage.h>
16 15
17#include "hfsplus_fs.h" 16#include "hfsplus_fs.h"
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 452fc1fdbd3..0ce1c455ae5 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -14,7 +14,6 @@
14#include <linux/fs.h> 14#include <linux/fs.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/version.h>
18#include <linux/vfs.h> 17#include <linux/vfs.h>
19#include <linux/nls.h> 18#include <linux/nls.h>
20 19
diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c
index 0c51d6338b0..95455e83923 100644
--- a/fs/hfsplus/wrapper.c
+++ b/fs/hfsplus/wrapper.c
@@ -12,7 +12,6 @@
12#include <linux/blkdev.h> 12#include <linux/blkdev.h>
13#include <linux/cdrom.h> 13#include <linux/cdrom.h>
14#include <linux/genhd.h> 14#include <linux/genhd.h>
15#include <linux/version.h>
16#include <asm/unaligned.h> 15#include <asm/unaligned.h>
17 16
18#include "hfsplus_fs.h" 17#include "hfsplus_fs.h"
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index a33fb1d9137..4684eb7d48c 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -8,7 +8,6 @@
8 8
9#include <linux/stddef.h> 9#include <linux/stddef.h>
10#include <linux/fs.h> 10#include <linux/fs.h>
11#include <linux/version.h>
12#include <linux/module.h> 11#include <linux/module.h>
13#include <linux/init.h> 12#include <linux/init.h>
14#include <linux/slab.h> 13#include <linux/slab.h>
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c
index ab144dabd87..7c995ac4081 100644
--- a/fs/hpfs/file.c
+++ b/fs/hpfs/file.c
@@ -114,11 +114,8 @@ static ssize_t hpfs_file_write(struct file *file, const char __user *buf,
114 ssize_t retval; 114 ssize_t retval;
115 115
116 retval = generic_file_write(file, buf, count, ppos); 116 retval = generic_file_write(file, buf, count, ppos);
117 if (retval > 0) { 117 if (retval > 0)
118 struct inode *inode = file->f_dentry->d_inode; 118 hpfs_i(file->f_dentry->d_inode)->i_dirty = 1;
119 inode->i_mtime = CURRENT_TIME_SEC;
120 hpfs_i(inode)->i_dirty = 1;
121 }
122 return retval; 119 return retval;
123} 120}
124 121
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index e026c807e6b..64983ab5558 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -63,7 +63,7 @@ static void huge_pagevec_release(struct pagevec *pvec)
63 * 63 *
64 * Result is in bytes to be compatible with is_hugepage_mem_enough() 64 * Result is in bytes to be compatible with is_hugepage_mem_enough()
65 */ 65 */
66unsigned long 66static unsigned long
67huge_pages_needed(struct address_space *mapping, struct vm_area_struct *vma) 67huge_pages_needed(struct address_space *mapping, struct vm_area_struct *vma)
68{ 68{
69 int i; 69 int i;
diff --git a/fs/inotify.c b/fs/inotify.c
index 9fbaebfdf40..bf7ce1d2412 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -372,7 +372,7 @@ static int find_inode(const char __user *dirname, struct nameidata *nd)
372 if (error) 372 if (error)
373 return error; 373 return error;
374 /* you can only watch an inode if you have read permissions on it */ 374 /* you can only watch an inode if you have read permissions on it */
375 error = permission(nd->dentry->d_inode, MAY_READ, NULL); 375 error = vfs_permission(nd, MAY_READ);
376 if (error) 376 if (error)
377 path_release(nd); 377 path_release(nd);
378 return error; 378 return error;
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 1abe7343f92..4abbe860430 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -827,6 +827,7 @@ static int jfs_link(struct dentry *old_dentry,
827 /* update object inode */ 827 /* update object inode */
828 ip->i_nlink++; /* for new link */ 828 ip->i_nlink++; /* for new link */
829 ip->i_ctime = CURRENT_TIME; 829 ip->i_ctime = CURRENT_TIME;
830 dir->i_ctime = dir->i_mtime = CURRENT_TIME;
830 mark_inode_dirty(dir); 831 mark_inode_dirty(dir);
831 atomic_inc(&ip->i_count); 832 atomic_inc(&ip->i_count);
832 833
@@ -1024,6 +1025,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
1024 insert_inode_hash(ip); 1025 insert_inode_hash(ip);
1025 mark_inode_dirty(ip); 1026 mark_inode_dirty(ip);
1026 1027
1028 dip->i_ctime = dip->i_mtime = CURRENT_TIME;
1029 mark_inode_dirty(dip);
1027 /* 1030 /*
1028 * commit update of parent directory and link object 1031 * commit update of parent directory and link object
1029 */ 1032 */
diff --git a/fs/namei.c b/fs/namei.c
index b3f8a1966c9..6dbbd42d8b9 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -256,6 +256,38 @@ int permission(struct inode *inode, int mask, struct nameidata *nd)
256 return security_inode_permission(inode, mask, nd); 256 return security_inode_permission(inode, mask, nd);
257} 257}
258 258
259/**
260 * vfs_permission - check for access rights to a given path
261 * @nd: lookup result that describes the path
262 * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC)
263 *
264 * Used to check for read/write/execute permissions on a path.
265 * We use "fsuid" for this, letting us set arbitrary permissions
266 * for filesystem access without changing the "normal" uids which
267 * are used for other things.
268 */
269int vfs_permission(struct nameidata *nd, int mask)
270{
271 return permission(nd->dentry->d_inode, mask, nd);
272}
273
274/**
275 * file_permission - check for additional access rights to a given file
276 * @file: file to check access rights for
277 * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC)
278 *
279 * Used to check for read/write/execute permissions on an already opened
280 * file.
281 *
282 * Note:
283 * Do not use this function in new code. All access checks should
284 * be done using vfs_permission().
285 */
286int file_permission(struct file *file, int mask)
287{
288 return permission(file->f_dentry->d_inode, mask, NULL);
289}
290
259/* 291/*
260 * get_write_access() gets write permission for a file. 292 * get_write_access() gets write permission for a file.
261 * put_write_access() releases this write permission. 293 * put_write_access() releases this write permission.
@@ -765,9 +797,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
765 797
766 nd->flags |= LOOKUP_CONTINUE; 798 nd->flags |= LOOKUP_CONTINUE;
767 err = exec_permission_lite(inode, nd); 799 err = exec_permission_lite(inode, nd);
768 if (err == -EAGAIN) { 800 if (err == -EAGAIN)
769 err = permission(inode, MAY_EXEC, nd); 801 err = vfs_permission(nd, MAY_EXEC);
770 }
771 if (err) 802 if (err)
772 break; 803 break;
773 804
@@ -1109,8 +1140,9 @@ int path_lookup_open(const char *name, unsigned int lookup_flags,
1109 * @open_flags: open intent flags 1140 * @open_flags: open intent flags
1110 * @create_mode: create intent flags 1141 * @create_mode: create intent flags
1111 */ 1142 */
1112int path_lookup_create(const char *name, unsigned int lookup_flags, 1143static int path_lookup_create(const char *name, unsigned int lookup_flags,
1113 struct nameidata *nd, int open_flags, int create_mode) 1144 struct nameidata *nd, int open_flags,
1145 int create_mode)
1114{ 1146{
1115 return __path_lookup_intent_open(name, lookup_flags|LOOKUP_CREATE, nd, 1147 return __path_lookup_intent_open(name, lookup_flags|LOOKUP_CREATE, nd,
1116 open_flags, create_mode); 1148 open_flags, create_mode);
@@ -1173,9 +1205,9 @@ out:
1173 return dentry; 1205 return dentry;
1174} 1206}
1175 1207
1176struct dentry * lookup_hash(struct qstr *name, struct dentry * base) 1208struct dentry * lookup_hash(struct nameidata *nd)
1177{ 1209{
1178 return __lookup_hash(name, base, NULL); 1210 return __lookup_hash(&nd->last, nd->dentry, nd);
1179} 1211}
1180 1212
1181/* SMP-safe */ 1213/* SMP-safe */
@@ -1199,7 +1231,7 @@ struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
1199 } 1231 }
1200 this.hash = end_name_hash(hash); 1232 this.hash = end_name_hash(hash);
1201 1233
1202 return lookup_hash(&this, base); 1234 return __lookup_hash(&this, base, NULL);
1203access: 1235access:
1204 return ERR_PTR(-EACCES); 1236 return ERR_PTR(-EACCES);
1205} 1237}
@@ -1407,7 +1439,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
1407 if (S_ISDIR(inode->i_mode) && (flag & FMODE_WRITE)) 1439 if (S_ISDIR(inode->i_mode) && (flag & FMODE_WRITE))
1408 return -EISDIR; 1440 return -EISDIR;
1409 1441
1410 error = permission(inode, acc_mode, nd); 1442 error = vfs_permission(nd, acc_mode);
1411 if (error) 1443 if (error)
1412 return error; 1444 return error;
1413 1445
@@ -1532,7 +1564,7 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
1532 dir = nd->dentry; 1564 dir = nd->dentry;
1533 nd->flags &= ~LOOKUP_PARENT; 1565 nd->flags &= ~LOOKUP_PARENT;
1534 down(&dir->d_inode->i_sem); 1566 down(&dir->d_inode->i_sem);
1535 path.dentry = __lookup_hash(&nd->last, nd->dentry, nd); 1567 path.dentry = lookup_hash(nd);
1536 path.mnt = nd->mnt; 1568 path.mnt = nd->mnt;
1537 1569
1538do_last: 1570do_last:
@@ -1634,7 +1666,7 @@ do_link:
1634 } 1666 }
1635 dir = nd->dentry; 1667 dir = nd->dentry;
1636 down(&dir->d_inode->i_sem); 1668 down(&dir->d_inode->i_sem);
1637 path.dentry = __lookup_hash(&nd->last, nd->dentry, nd); 1669 path.dentry = lookup_hash(nd);
1638 path.mnt = nd->mnt; 1670 path.mnt = nd->mnt;
1639 __putname(nd->last.name); 1671 __putname(nd->last.name);
1640 goto do_last; 1672 goto do_last;
@@ -1666,7 +1698,7 @@ struct dentry *lookup_create(struct nameidata *nd, int is_dir)
1666 /* 1698 /*
1667 * Do the final lookup. 1699 * Do the final lookup.
1668 */ 1700 */
1669 dentry = lookup_hash(&nd->last, nd->dentry); 1701 dentry = lookup_hash(nd);
1670 if (IS_ERR(dentry)) 1702 if (IS_ERR(dentry))
1671 goto fail; 1703 goto fail;
1672 1704
@@ -1901,7 +1933,7 @@ asmlinkage long sys_rmdir(const char __user * pathname)
1901 goto exit1; 1933 goto exit1;
1902 } 1934 }
1903 down(&nd.dentry->d_inode->i_sem); 1935 down(&nd.dentry->d_inode->i_sem);
1904 dentry = lookup_hash(&nd.last, nd.dentry); 1936 dentry = lookup_hash(&nd);
1905 error = PTR_ERR(dentry); 1937 error = PTR_ERR(dentry);
1906 if (!IS_ERR(dentry)) { 1938 if (!IS_ERR(dentry)) {
1907 error = vfs_rmdir(nd.dentry->d_inode, dentry); 1939 error = vfs_rmdir(nd.dentry->d_inode, dentry);
@@ -1970,7 +2002,7 @@ asmlinkage long sys_unlink(const char __user * pathname)
1970 if (nd.last_type != LAST_NORM) 2002 if (nd.last_type != LAST_NORM)
1971 goto exit1; 2003 goto exit1;
1972 down(&nd.dentry->d_inode->i_sem); 2004 down(&nd.dentry->d_inode->i_sem);
1973 dentry = lookup_hash(&nd.last, nd.dentry); 2005 dentry = lookup_hash(&nd);
1974 error = PTR_ERR(dentry); 2006 error = PTR_ERR(dentry);
1975 if (!IS_ERR(dentry)) { 2007 if (!IS_ERR(dentry)) {
1976 /* Why not before? Because we want correct error value */ 2008 /* Why not before? Because we want correct error value */
@@ -2313,7 +2345,7 @@ static inline int do_rename(const char * oldname, const char * newname)
2313 2345
2314 trap = lock_rename(new_dir, old_dir); 2346 trap = lock_rename(new_dir, old_dir);
2315 2347
2316 old_dentry = lookup_hash(&oldnd.last, old_dir); 2348 old_dentry = lookup_hash(&oldnd);
2317 error = PTR_ERR(old_dentry); 2349 error = PTR_ERR(old_dentry);
2318 if (IS_ERR(old_dentry)) 2350 if (IS_ERR(old_dentry))
2319 goto exit3; 2351 goto exit3;
@@ -2333,7 +2365,7 @@ static inline int do_rename(const char * oldname, const char * newname)
2333 error = -EINVAL; 2365 error = -EINVAL;
2334 if (old_dentry == trap) 2366 if (old_dentry == trap)
2335 goto exit4; 2367 goto exit4;
2336 new_dentry = lookup_hash(&newnd.last, new_dir); 2368 new_dentry = lookup_hash(&newnd);
2337 error = PTR_ERR(new_dentry); 2369 error = PTR_ERR(new_dentry);
2338 if (IS_ERR(new_dentry)) 2370 if (IS_ERR(new_dentry))
2339 goto exit4; 2371 goto exit4;
@@ -2536,6 +2568,8 @@ EXPORT_SYMBOL(path_lookup);
2536EXPORT_SYMBOL(path_release); 2568EXPORT_SYMBOL(path_release);
2537EXPORT_SYMBOL(path_walk); 2569EXPORT_SYMBOL(path_walk);
2538EXPORT_SYMBOL(permission); 2570EXPORT_SYMBOL(permission);
2571EXPORT_SYMBOL(vfs_permission);
2572EXPORT_SYMBOL(file_permission);
2539EXPORT_SYMBOL(unlock_rename); 2573EXPORT_SYMBOL(unlock_rename);
2540EXPORT_SYMBOL(vfs_create); 2574EXPORT_SYMBOL(vfs_create);
2541EXPORT_SYMBOL(vfs_follow_link); 2575EXPORT_SYMBOL(vfs_follow_link);
diff --git a/fs/namespace.c b/fs/namespace.c
index caa9187f67e..2019899f2ab 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -637,7 +637,7 @@ static int mount_is_safe(struct nameidata *nd)
637 if (current->uid != nd->dentry->d_inode->i_uid) 637 if (current->uid != nd->dentry->d_inode->i_uid)
638 return -EPERM; 638 return -EPERM;
639 } 639 }
640 if (permission(nd->dentry->d_inode, MAY_WRITE, nd)) 640 if (vfs_permission(nd, MAY_WRITE))
641 return -EPERM; 641 return -EPERM;
642 return 0; 642 return 0;
643#endif 643#endif
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c
index 88df79356a1..fd3efdca5ae 100644
--- a/fs/ncpfs/ioctl.c
+++ b/fs/ncpfs/ioctl.c
@@ -30,11 +30,13 @@
30#define NCP_PACKET_SIZE_INTERNAL 65536 30#define NCP_PACKET_SIZE_INTERNAL 65536
31 31
32static int 32static int
33ncp_get_fs_info(struct ncp_server* server, struct inode* inode, struct ncp_fs_info __user *arg) 33ncp_get_fs_info(struct ncp_server * server, struct file *file,
34 struct ncp_fs_info __user *arg)
34{ 35{
36 struct inode *inode = file->f_dentry->d_inode;
35 struct ncp_fs_info info; 37 struct ncp_fs_info info;
36 38
37 if ((permission(inode, MAY_WRITE, NULL) != 0) 39 if ((file_permission(file, MAY_WRITE) != 0)
38 && (current->uid != server->m.mounted_uid)) { 40 && (current->uid != server->m.mounted_uid)) {
39 return -EACCES; 41 return -EACCES;
40 } 42 }
@@ -58,11 +60,13 @@ ncp_get_fs_info(struct ncp_server* server, struct inode* inode, struct ncp_fs_in
58} 60}
59 61
60static int 62static int
61ncp_get_fs_info_v2(struct ncp_server* server, struct inode* inode, struct ncp_fs_info_v2 __user * arg) 63ncp_get_fs_info_v2(struct ncp_server * server, struct file *file,
64 struct ncp_fs_info_v2 __user * arg)
62{ 65{
66 struct inode *inode = file->f_dentry->d_inode;
63 struct ncp_fs_info_v2 info2; 67 struct ncp_fs_info_v2 info2;
64 68
65 if ((permission(inode, MAY_WRITE, NULL) != 0) 69 if ((file_permission(file, MAY_WRITE) != 0)
66 && (current->uid != server->m.mounted_uid)) { 70 && (current->uid != server->m.mounted_uid)) {
67 return -EACCES; 71 return -EACCES;
68 } 72 }
@@ -190,7 +194,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
190 switch (cmd) { 194 switch (cmd) {
191 case NCP_IOC_NCPREQUEST: 195 case NCP_IOC_NCPREQUEST:
192 196
193 if ((permission(inode, MAY_WRITE, NULL) != 0) 197 if ((file_permission(filp, MAY_WRITE) != 0)
194 && (current->uid != server->m.mounted_uid)) { 198 && (current->uid != server->m.mounted_uid)) {
195 return -EACCES; 199 return -EACCES;
196 } 200 }
@@ -245,16 +249,16 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
245 return ncp_conn_logged_in(inode->i_sb); 249 return ncp_conn_logged_in(inode->i_sb);
246 250
247 case NCP_IOC_GET_FS_INFO: 251 case NCP_IOC_GET_FS_INFO:
248 return ncp_get_fs_info(server, inode, argp); 252 return ncp_get_fs_info(server, filp, argp);
249 253
250 case NCP_IOC_GET_FS_INFO_V2: 254 case NCP_IOC_GET_FS_INFO_V2:
251 return ncp_get_fs_info_v2(server, inode, argp); 255 return ncp_get_fs_info_v2(server, filp, argp);
252 256
253 case NCP_IOC_GETMOUNTUID2: 257 case NCP_IOC_GETMOUNTUID2:
254 { 258 {
255 unsigned long tmp = server->m.mounted_uid; 259 unsigned long tmp = server->m.mounted_uid;
256 260
257 if ( (permission(inode, MAY_READ, NULL) != 0) 261 if ((file_permission(filp, MAY_READ) != 0)
258 && (current->uid != server->m.mounted_uid)) 262 && (current->uid != server->m.mounted_uid))
259 { 263 {
260 return -EACCES; 264 return -EACCES;
@@ -268,7 +272,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
268 { 272 {
269 struct ncp_setroot_ioctl sr; 273 struct ncp_setroot_ioctl sr;
270 274
271 if ( (permission(inode, MAY_READ, NULL) != 0) 275 if ((file_permission(filp, MAY_READ) != 0)
272 && (current->uid != server->m.mounted_uid)) 276 && (current->uid != server->m.mounted_uid))
273 { 277 {
274 return -EACCES; 278 return -EACCES;
@@ -343,7 +347,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
343 347
344#ifdef CONFIG_NCPFS_PACKET_SIGNING 348#ifdef CONFIG_NCPFS_PACKET_SIGNING
345 case NCP_IOC_SIGN_INIT: 349 case NCP_IOC_SIGN_INIT:
346 if ((permission(inode, MAY_WRITE, NULL) != 0) 350 if ((file_permission(filp, MAY_WRITE) != 0)
347 && (current->uid != server->m.mounted_uid)) 351 && (current->uid != server->m.mounted_uid))
348 { 352 {
349 return -EACCES; 353 return -EACCES;
@@ -366,7 +370,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
366 return 0; 370 return 0;
367 371
368 case NCP_IOC_SIGN_WANTED: 372 case NCP_IOC_SIGN_WANTED:
369 if ( (permission(inode, MAY_READ, NULL) != 0) 373 if ((file_permission(filp, MAY_READ) != 0)
370 && (current->uid != server->m.mounted_uid)) 374 && (current->uid != server->m.mounted_uid))
371 { 375 {
372 return -EACCES; 376 return -EACCES;
@@ -379,7 +383,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
379 { 383 {
380 int newstate; 384 int newstate;
381 385
382 if ( (permission(inode, MAY_WRITE, NULL) != 0) 386 if ((file_permission(filp, MAY_WRITE) != 0)
383 && (current->uid != server->m.mounted_uid)) 387 && (current->uid != server->m.mounted_uid))
384 { 388 {
385 return -EACCES; 389 return -EACCES;
@@ -400,7 +404,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
400 404
401#ifdef CONFIG_NCPFS_IOCTL_LOCKING 405#ifdef CONFIG_NCPFS_IOCTL_LOCKING
402 case NCP_IOC_LOCKUNLOCK: 406 case NCP_IOC_LOCKUNLOCK:
403 if ( (permission(inode, MAY_WRITE, NULL) != 0) 407 if ((file_permission(filp, MAY_WRITE) != 0)
404 && (current->uid != server->m.mounted_uid)) 408 && (current->uid != server->m.mounted_uid))
405 { 409 {
406 return -EACCES; 410 return -EACCES;
@@ -605,7 +609,7 @@ outrel:
605#endif /* CONFIG_NCPFS_NLS */ 609#endif /* CONFIG_NCPFS_NLS */
606 610
607 case NCP_IOC_SETDENTRYTTL: 611 case NCP_IOC_SETDENTRYTTL:
608 if ((permission(inode, MAY_WRITE, NULL) != 0) && 612 if ((file_permission(filp, MAY_WRITE) != 0) &&
609 (current->uid != server->m.mounted_uid)) 613 (current->uid != server->m.mounted_uid))
610 return -EACCES; 614 return -EACCES;
611 { 615 {
@@ -635,7 +639,7 @@ outrel:
635 so we have this out of switch */ 639 so we have this out of switch */
636 if (cmd == NCP_IOC_GETMOUNTUID) { 640 if (cmd == NCP_IOC_GETMOUNTUID) {
637 __kernel_uid_t uid = 0; 641 __kernel_uid_t uid = 0;
638 if ((permission(inode, MAY_READ, NULL) != 0) 642 if ((file_permission(filp, MAY_READ) != 0)
639 && (current->uid != server->m.mounted_uid)) { 643 && (current->uid != server->m.mounted_uid)) {
640 return -EACCES; 644 return -EACCES;
641 } 645 }
diff --git a/fs/open.c b/fs/open.c
index 6e8136751e9..f53a5b9ffb7 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -240,7 +240,7 @@ static inline long do_sys_truncate(const char __user * path, loff_t length)
240 if (!S_ISREG(inode->i_mode)) 240 if (!S_ISREG(inode->i_mode))
241 goto dput_and_out; 241 goto dput_and_out;
242 242
243 error = permission(inode,MAY_WRITE,&nd); 243 error = vfs_permission(&nd, MAY_WRITE);
244 if (error) 244 if (error)
245 goto dput_and_out; 245 goto dput_and_out;
246 246
@@ -394,7 +394,7 @@ asmlinkage long sys_utime(char __user * filename, struct utimbuf __user * times)
394 goto dput_and_out; 394 goto dput_and_out;
395 395
396 if (current->fsuid != inode->i_uid && 396 if (current->fsuid != inode->i_uid &&
397 (error = permission(inode,MAY_WRITE,&nd)) != 0) 397 (error = vfs_permission(&nd, MAY_WRITE)) != 0)
398 goto dput_and_out; 398 goto dput_and_out;
399 } 399 }
400 down(&inode->i_sem); 400 down(&inode->i_sem);
@@ -447,7 +447,7 @@ long do_utimes(char __user * filename, struct timeval * times)
447 goto dput_and_out; 447 goto dput_and_out;
448 448
449 if (current->fsuid != inode->i_uid && 449 if (current->fsuid != inode->i_uid &&
450 (error = permission(inode,MAY_WRITE,&nd)) != 0) 450 (error = vfs_permission(&nd, MAY_WRITE)) != 0)
451 goto dput_and_out; 451 goto dput_and_out;
452 } 452 }
453 down(&inode->i_sem); 453 down(&inode->i_sem);
@@ -506,7 +506,7 @@ asmlinkage long sys_access(const char __user * filename, int mode)
506 506
507 res = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd); 507 res = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd);
508 if (!res) { 508 if (!res) {
509 res = permission(nd.dentry->d_inode, mode, &nd); 509 res = vfs_permission(&nd, mode);
510 /* SuS v2 requires we report a read only fs too */ 510 /* SuS v2 requires we report a read only fs too */
511 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode) 511 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
512 && !special_file(nd.dentry->d_inode->i_mode)) 512 && !special_file(nd.dentry->d_inode->i_mode))
@@ -530,7 +530,7 @@ asmlinkage long sys_chdir(const char __user * filename)
530 if (error) 530 if (error)
531 goto out; 531 goto out;
532 532
533 error = permission(nd.dentry->d_inode,MAY_EXEC,&nd); 533 error = vfs_permission(&nd, MAY_EXEC);
534 if (error) 534 if (error)
535 goto dput_and_out; 535 goto dput_and_out;
536 536
@@ -563,7 +563,7 @@ asmlinkage long sys_fchdir(unsigned int fd)
563 if (!S_ISDIR(inode->i_mode)) 563 if (!S_ISDIR(inode->i_mode))
564 goto out_putf; 564 goto out_putf;
565 565
566 error = permission(inode, MAY_EXEC, NULL); 566 error = file_permission(file, MAY_EXEC);
567 if (!error) 567 if (!error)
568 set_fs_pwd(current->fs, mnt, dentry); 568 set_fs_pwd(current->fs, mnt, dentry);
569out_putf: 569out_putf:
@@ -581,7 +581,7 @@ asmlinkage long sys_chroot(const char __user * filename)
581 if (error) 581 if (error)
582 goto out; 582 goto out;
583 583
584 error = permission(nd.dentry->d_inode,MAY_EXEC,&nd); 584 error = vfs_permission(&nd, MAY_EXEC);
585 if (error) 585 if (error)
586 goto dput_and_out; 586 goto dput_and_out;
587 587
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index c20babd6216..7892a865b58 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -251,12 +251,12 @@ static int reiserfs_allocate_blocks_for_region(struct reiserfs_transaction_handl
251 blocks_to_allocate, 251 blocks_to_allocate,
252 blocks_to_allocate); 252 blocks_to_allocate);
253 if (res != CARRY_ON) { 253 if (res != CARRY_ON) {
254 res = -ENOSPC; 254 res = res == QUOTA_EXCEEDED ? -EDQUOT : -ENOSPC;
255 pathrelse(&path); 255 pathrelse(&path);
256 goto error_exit; 256 goto error_exit;
257 } 257 }
258 } else { 258 } else {
259 res = -ENOSPC; 259 res = res == QUOTA_EXCEEDED ? -EDQUOT : -ENOSPC;
260 pathrelse(&path); 260 pathrelse(&path);
261 goto error_exit; 261 goto error_exit;
262 } 262 }
diff --git a/fs/udf/file.c b/fs/udf/file.c
index bb40d63f328..01f520c71dc 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -186,7 +186,7 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
186{ 186{
187 int result = -EINVAL; 187 int result = -EINVAL;
188 188
189 if ( permission(inode, MAY_READ, NULL) != 0 ) 189 if ( file_permission(filp, MAY_READ) != 0 )
190 { 190 {
191 udf_debug("no permission to access inode %lu\n", 191 udf_debug("no permission to access inode %lu\n",
192 inode->i_ino); 192 inode->i_ino);
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h
index 44fed10af0d..d8e21ba0ccc 100644
--- a/fs/xfs/linux-2.6/xfs_linux.h
+++ b/fs/xfs/linux-2.6/xfs_linux.h
@@ -72,7 +72,6 @@
72#include <linux/init.h> 72#include <linux/init.h>
73#include <linux/list.h> 73#include <linux/list.h>
74#include <linux/proc_fs.h> 74#include <linux/proc_fs.h>
75#include <linux/version.h>
76#include <linux/sort.h> 75#include <linux/sort.h>
77 76
78#include <asm/page.h> 77#include <asm/page.h>
diff --git a/fs/xfs/xfs.h b/fs/xfs/xfs.h
index 99b50d2bda9..1a48dbb902a 100644
--- a/fs/xfs/xfs.h
+++ b/fs/xfs/xfs.h
@@ -17,12 +17,5 @@
17 */ 17 */
18#ifndef __XFS_H__ 18#ifndef __XFS_H__
19#define __XFS_H__ 19#define __XFS_H__
20
21#include <linux/version.h>
22#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
23#include <linux-2.6/xfs_linux.h> 20#include <linux-2.6/xfs_linux.h>
24#else
25#include <linux-2.4/xfs_linux.h>
26#endif
27
28#endif /* __XFS_H__ */ 21#endif /* __XFS_H__ */
diff --git a/fs/xfs/xfs_dmapi.h b/fs/xfs/xfs_dmapi.h
index 5a5c7a63e80..864bf695568 100644
--- a/fs/xfs/xfs_dmapi.h
+++ b/fs/xfs/xfs_dmapi.h
@@ -18,6 +18,7 @@
18#ifndef __XFS_DMAPI_H__ 18#ifndef __XFS_DMAPI_H__
19#define __XFS_DMAPI_H__ 19#define __XFS_DMAPI_H__
20 20
21#include <linux/version.h>
21/* Values used to define the on-disk version of dm_attrname_t. All 22/* Values used to define the on-disk version of dm_attrname_t. All
22 * on-disk attribute names start with the 8-byte string "SGI_DMI_". 23 * on-disk attribute names start with the 8-byte string "SGI_DMI_".
23 * 24 *