Messages in this thread Patch in this message |  | | From | Andreas Dilger <> | Subject | [PATCH] ext2_fs.h should not be included | Date | Thu, 24 Aug 2000 15:55:25 -0600 (MDT) |
| |
Hello, I think the ext2_fs.h file is needlessly included in a few places in the kernel source, causing me full-kernel recompiles whenever I change it (I do it often enough for me to want to fix it). It also appears to be the source of a couple of copy-paste bugs in UFS and UDF.
* It is included in kernel/ksyms.c, yet ext2 does not export any symbols. * It is included in include/linux/ext2_fs_sb.h (for no reason that I can see), which is itself included by include/fs.h, which is included by half of the kernel. (Similarly, ext3_fs.h is in ext3_fs_sb.h - for Stephen to remove). * It is included in fs/adfs/file.c, again for no observable reason, except maybe because fs/adfs/file.c is based on fs/ext2/file.c.
* As a result of including ext2_fs.h indirectly, the ext2-specific test_opt() macro was being used in fs/ufs/ialloc.c, which was creating bogus GID inheritance for new files in UFS, by randomly checking Ext2 fields holding UFS data. BSD (hence UFS) semantics mean files inherit the dir GID always. Maybe UFS needs a sysvgroups/nogrpid mount option? * UDF has the same problem as UFS (referencing u.ext2_i "data"), so I fixed it to have SYSV semantics. I don't know if this is correct or not, but at least it is not random behaviour... The UDF and UFS problems are probably rarely seen, as these filesystems are mostly used read-only under Linux.
Please consider the following patches, for both 2.2 and 2.4. AFAICS, the patchew will apply cleanly to both 2.2.17 and 2.4.0-whatever.
Cheers, Andreas
PS - please CC me, as I haven't been gotten any new l-k mail yet. ----------------------------------------------------------------- diff -u linux/fs/adfs/file.c~ linux/fs/adfs/file.c --- linux/fs/adfs/file.c~ Sun Mar 19 22:22:55 2000 +++ linux/fs/adfs/file.c Thu Aug 24 14:51:38 2000 @@ -22,7 +22,6 @@ #include <linux/version.h> #include <linux/errno.h> #include <linux/fs.h> -#include <linux/ext2_fs.h> #include <linux/fcntl.h> #include <linux/sched.h> #include <linux/stat.h> diff -u linux/fs/nfsd/vfs.c~ linux/fs/nfsd/vfs.c --- linux/fs/nfsd/vfs.c~ Thu Apr 27 22:42:22 2000 +++ linux/fs/nfsd/vfs.c Thu Aug 24 14:53:58 2000 @@ -22,7 +22,6 @@ #include <linux/locks.h> #include <linux/fs.h> #include <linux/major.h> -#include <linux/ext2_fs.h> #include <linux/proc_fs.h> #include <linux/stat.h> #include <linux/fcntl.h> diff -u linux-2.3.99p5/fs/udf/ialloc.c linux/fs/udf/ialloc.c --- linux-2.3.99p5/fs/udf/ialloc.c Sun Mar 19 22:23:28 2000 +++ linux/fs/udf/ialloc.c Thu Aug 24 15:28:03 2000 @@ -140,15 +140,11 @@ inode->i_nlink = 1; inode->i_dev = sb->s_dev; inode->i_uid = current->fsuid; - if (test_opt (sb, GRPID)) - inode->i_gid = dir->i_gid; - else if (dir->i_mode & S_ISGID) - { + if (dir->i_mode & S_ISGID) { inode->i_gid = dir->i_gid; if (S_ISDIR(mode)) mode |= S_ISGID; - } - else + } else inode->i_gid = current->fsgid; UDF_I_LOCATION(inode).logicalBlockNum = block; diff -u linux/fs/ufs/ialloc.c~ linux/fs/ufs/ialloc.c --- linux-2.3.99p5/fs/ufs/ialloc.c~ Sun Mar 19 22:23:01 2000 +++ linux/fs/ufs/ialloc.c Thu Aug 24 15:18:02 2000 @@ -275,15 +275,7 @@ inode->i_nlink = 1; inode->i_dev = sb->s_dev; inode->i_uid = current->fsuid; - if (test_opt (sb, GRPID)) - inode->i_gid = dir->i_gid; - else if (dir->i_mode & S_ISGID) { - inode->i_gid = dir->i_gid; - if (S_ISDIR(mode)) - mode |= S_ISGID; - } else - inode->i_gid = current->fsgid; - + inode->i_gid = dir->i_gid; inode->i_ino = cg * uspi->s_ipg + bit; inode->i_blksize = PAGE_SIZE; /* This is the optimal IO size (for stat), not the fs block size */ inode->i_blocks = 0; diff -u include/linux/ext2_fs_sb.h~ include/linux/ext2_fs_sb.h --- include/linux/ext2_fs_sb.h~ Mon Mar 12 1999 12:13:33 +++ include/linux/ext2_fs_sb.h Thu Aug 24 2000 14:49:02 @@ -16,7 +16,6 @@ #ifndef _LINUX_EXT2_FS_SB #define _LINUX_EXT2_FS_SB -#include <linux/ext2_fs.h> /* * The following is not needed anymore since the descriptors buffer diff -u linux-2.3.99p5/kernel/ksyms.c~ linux/kernel/ksyms.c --- linux/kernel/ksyms.c~ Thu Apr 27 22:42:26 2000 +++ linux/kernel/ksyms.c Thu Aug 24 14:41:14 2000 @@ -23,8 +23,6 @@ #include <linux/serial.h> #include <linux/locks.h> #include <linux/delay.h> -#include <linux/minix_fs.h> -#include <linux/ext2_fs.h> #include <linux/random.h> #include <linux/reboot.h> #include <linux/pagemap.h> -- Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto, \ would they cancel out, leaving him still hungry?" http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |