Re: [PATCH] disk quotas fail when /etc/mtab is symlinked to /proc/mounts
Jan Kara wrote: Hello, If /etc/mtab is a regular file all of the mount options (of a file system) are written to /etc/mtab by the mount command. The quota tools look there for the quota strings for their operation. If, however, /etc/mtab is a symlink to /proc/mounts (a "good thing" in some environments) the tools don't write anything - they assume the kernel will take care of things. While the quota options are sent down to the kernel via the mount system call and the file system codes handle them properly unfortunately there is no code to echo the quota strings into /proc/mounts and the quota tools fail in the symlink case. Yes, I agree that it's a good think to have quota options in /proc/mounts. Doing it per filesystem is not nice but I don't know a nice way of doing it a VFS level either... I'll have a new patch which includes your comments and a few I thought up soon. I'll repost the new patch. mark The attached patchs modify the EXT[2|3] and [X|J]FS codes to add the necessary hooks. The show_options function of each file system in these patches currently deal with only those things that seemed related to quotas; especially in the EXT3 case more can be done (later?). The EXT3 has added error checking and has two minor changes: The "quota" option is considered part of the older style quotas Journalled quotas and older style quotas are mutually exclusive. - both discussable topics Ack. mark Signed-off-by: Mark Bellon <[EMAIL PROTECTED]> Thanks for the patch - I have some comments below... #ifdef CONFIG_QUOTA +static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs) +{ + struct ext3_sb_info *sbi = EXT3_SB(vfs->mnt_sb); + + if (sbi->s_mount_opt & EXT3_MOUNT_JOURNAL_DATA) + seq_puts(seq, ",data=journal"); + + if (sbi->s_mount_opt & EXT3_MOUNT_ORDERED_DATA) + seq_puts(seq, ",data=ordered"); + + if (sbi->s_mount_opt & EXT3_MOUNT_WRITEBACK_DATA) + seq_puts(seq, ",data=writeback"); Showing 'data' option only when quota is compile is ugly... Please move CONFIG_QUOTA inside only around quota specific stuff. + + if (sbi->s_jquota_fmt) + seq_printf(seq, ",jqfmt=%s", + (sbi->s_jquota_fmt == QFMT_VFS_OLD) ? "vfsold": "vfsv0"); + + if (sbi->s_qf_names[USRQUOTA]) + seq_printf(seq, ",usrjquota=%s", sbi->s_qf_names[USRQUOTA]); + + if (sbi->s_qf_names[GRPQUOTA]) + seq_printf(seq, ",grpjquota=%s", sbi->s_qf_names[GRPQUOTA]); + + if (sbi->s_mount_opt & EXT3_MOUNT_USRQUOTA) + seq_puts(seq, ",usrquota"); + + if (sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA) + seq_puts(seq, ",grpquota"); + + return 0; +} #define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group") #define QTYPE2MOPT(on, t) ((t)==USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA)) @@ -572,6 +604,7 @@ #ifdef CONFIG_QUOTA .quota_read = ext3_quota_read, .quota_write= ext3_quota_write, + .show_options = ext3_show_options, Probably set this function everytime... + case Opt_quota: + case Opt_usrquota: + case Opt_grpquota: case Opt_usrjquota: case Opt_grpjquota: case Opt_offusrjquota: @@ -924,7 +973,6 @@ "EXT3-fs: journalled quota options not " "supported.\n"); break; - case Opt_quota: case Opt_noquota: break; I'm not sure with the above change.. Previously if you mounted a filesystem with 'usrquota' option without a kernel quota support the mount succeeded. With your patch it will fail. I agree that that makes more sense but I'm not sure it's correct to change a behaviour so suddently. Maybe just issue a warning but let the mount succeed. #endif @@ -962,11 +1010,36 @@ } } #ifdef CONFIG_QUOTA - if (!sbi->s_jquota_fmt && (sbi->s_qf_names[USRQUOTA] || - sbi->s_qf_names[GRPQUOTA])) { - printk(KERN_ERR + if (sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) { + if ((sbi->s_mount_opt & EXT3_MOUNT_USRQUOTA) || + (sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA)) { + printk(KERN_ERR + "EXT3-fs: only one type of quotas allowed.\n"); + + return 0; + } + + if (!sbi->s_jquota_fmt) { + printk(KERN_ERR "EXT3-fs: journalled quota format not specified.\n"); - return 0; + + return 0; + } + + if ((sbi->s_mount_opt & EXT3_MOUNT_JOURNAL_DATA) == 0) { This test does not make sense - journaled quota in recent kernels works with arbitrary journaling data mode. +
Re: [PATCH] disk quotas fail when /etc/mtab is symlinked to /proc/mounts
Hello, > If /etc/mtab is a regular file all of the mount options (of a file > system) are written to /etc/mtab by the mount command. The quota tools > look there for the quota strings for their operation. If, however, > /etc/mtab is a symlink to /proc/mounts (a "good thing" in some > environments) the tools don't write anything - they assume the kernel > will take care of things. > > While the quota options are sent down to the kernel via the mount system > call and the file system codes handle them properly unfortunately there > is no code to echo the quota strings into /proc/mounts and the quota > tools fail in the symlink case. Yes, I agree that it's a good think to have quota options in /proc/mounts. Doing it per filesystem is not nice but I don't know a nice way of doing it a VFS level either... > The attached patchs modify the EXT[2|3] and [X|J]FS codes to add the > necessary hooks. The show_options function of each file system in these > patches currently deal with only those things that seemed related to > quotas; especially in the EXT3 case more can be done (later?). > > The EXT3 has added error checking and has two minor changes: >The "quota" option is considered part of the older style quotas >Journalled quotas and older style quotas are mutually exclusive. >- both discussable topics Ack. > mark > > Signed-off-by: Mark Bellon <[EMAIL PROTECTED]> > Thanks for the patch - I have some comments below... > #ifdef CONFIG_QUOTA > +static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs) > +{ > + struct ext3_sb_info *sbi = EXT3_SB(vfs->mnt_sb); > + > + if (sbi->s_mount_opt & EXT3_MOUNT_JOURNAL_DATA) > + seq_puts(seq, ",data=journal"); > + > + if (sbi->s_mount_opt & EXT3_MOUNT_ORDERED_DATA) > + seq_puts(seq, ",data=ordered"); > + > + if (sbi->s_mount_opt & EXT3_MOUNT_WRITEBACK_DATA) > + seq_puts(seq, ",data=writeback"); Showing 'data' option only when quota is compile is ugly... Please move CONFIG_QUOTA inside only around quota specific stuff. > + > + if (sbi->s_jquota_fmt) > + seq_printf(seq, ",jqfmt=%s", > + (sbi->s_jquota_fmt == QFMT_VFS_OLD) ? "vfsold": "vfsv0"); > + > + if (sbi->s_qf_names[USRQUOTA]) > + seq_printf(seq, ",usrjquota=%s", sbi->s_qf_names[USRQUOTA]); > + > + if (sbi->s_qf_names[GRPQUOTA]) > + seq_printf(seq, ",grpjquota=%s", sbi->s_qf_names[GRPQUOTA]); > + > + if (sbi->s_mount_opt & EXT3_MOUNT_USRQUOTA) > + seq_puts(seq, ",usrquota"); > + > + if (sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA) > + seq_puts(seq, ",grpquota"); > + > + return 0; > +} > > #define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group") > #define QTYPE2MOPT(on, t) ((t)==USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA)) > @@ -572,6 +604,7 @@ > #ifdef CONFIG_QUOTA > .quota_read = ext3_quota_read, > .quota_write= ext3_quota_write, > + .show_options = ext3_show_options, Probably set this function everytime... > + case Opt_quota: > + case Opt_usrquota: > + case Opt_grpquota: > case Opt_usrjquota: > case Opt_grpjquota: > case Opt_offusrjquota: > @@ -924,7 +973,6 @@ > "EXT3-fs: journalled quota options not " > "supported.\n"); > break; > - case Opt_quota: > case Opt_noquota: > break; I'm not sure with the above change.. Previously if you mounted a filesystem with 'usrquota' option without a kernel quota support the mount succeeded. With your patch it will fail. I agree that that makes more sense but I'm not sure it's correct to change a behaviour so suddently. Maybe just issue a warning but let the mount succeed. > #endif > @@ -962,11 +1010,36 @@ > } > } > #ifdef CONFIG_QUOTA > - if (!sbi->s_jquota_fmt && (sbi->s_qf_names[USRQUOTA] || > - sbi->s_qf_names[GRPQUOTA])) { > - printk(KERN_ERR > + if (sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) { > + if ((sbi->s_mount_opt & EXT3_MOUNT_USRQUOTA) || > + (sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA)) { > + printk(KERN_ERR > + "EXT3-fs: only one type of quotas allowed.\n"); > + > + return 0; > + } > + > + if (!sbi->s_jquota_fmt) { > + printk(KERN_ERR > "EXT3-fs: journalled quota format not specified.\n"); > - return 0; > + > + return 0; > + } > + > + if ((sbi->s_mount_opt & EXT3_MOUNT_JOURNAL_DATA) == 0) { This test does not make sense - journaled quota in recent kernels works with arbitrary journaling data mode. > + printk(KERN_ERR > + "EXT3-fs: journalled q
Re: [PATCH] disk quotas fail when /etc/mtab is symlinked to /proc/mounts
Mark Bellon wrote: Andrew Morton wrote: Mark Bellon <[EMAIL PROTECTED]> wrote: If /etc/mtab is a regular file all of the mount options (of a file system) are written to /etc/mtab by the mount command. The quota tools look there for the quota strings for their operation. If, however, /etc/mtab is a symlink to /proc/mounts (a "good thing" in some environments) the tools don't write anything - they assume the kernel will take care of things. While the quota options are sent down to the kernel via the mount system call and the file system codes handle them properly unfortunately there is no code to echo the quota strings into /proc/mounts and the quota tools fail in the symlink case. hm. Perhaps others with operational experience in that area can comment. OK. The attached patchs modify the EXT[2|3] and [X|J]FS codes to add the necessary hooks. The show_options function of each file system in these patches currently deal with only those things that seemed related to quotas; especially in the EXT3 case more can be done (later?). It seems sad to do it in each filesystem. Is there no way in which we can do this for all filesystems, in a single place in the VFS? Each file system must be able to echo it's own FS specific options, hence the show_options hook (XFS is a good example). EXT3 has it's own form of journalled quota file options, hence the need for the specific hook. The "older style" (e.g. "usrquota", "grpquota", "quota") could be done generically but a FS might want any number of quota options. The few lines of code in each file system didn't seem so bad especially if the show_function start echoing more. Followup comment/through... If we want /proc/mounts to really replace /etc/mtab in the general case, always using it as a symlink, the file system codes will all need the show_options hook - they will need to echo all of their private options duplicating, as closely as possible, what would have been written to the /etc/mtab regular file. mark mark - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] disk quotas fail when /etc/mtab is symlinked to /proc/mounts
Andrew Morton wrote: Mark Bellon <[EMAIL PROTECTED]> wrote: If /etc/mtab is a regular file all of the mount options (of a file system) are written to /etc/mtab by the mount command. The quota tools look there for the quota strings for their operation. If, however, /etc/mtab is a symlink to /proc/mounts (a "good thing" in some environments) the tools don't write anything - they assume the kernel will take care of things. While the quota options are sent down to the kernel via the mount system call and the file system codes handle them properly unfortunately there is no code to echo the quota strings into /proc/mounts and the quota tools fail in the symlink case. hm. Perhaps others with operational experience in that area can comment. OK. The attached patchs modify the EXT[2|3] and [X|J]FS codes to add the necessary hooks. The show_options function of each file system in these patches currently deal with only those things that seemed related to quotas; especially in the EXT3 case more can be done (later?). It seems sad to do it in each filesystem. Is there no way in which we can do this for all filesystems, in a single place in the VFS? Each file system must be able to echo it's own FS specific options, hence the show_options hook (XFS is a good example). EXT3 has it's own form of journalled quota file options, hence the need for the specific hook. The "older style" (e.g. "usrquota", "grpquota", "quota") could be done generically but a FS might want any number of quota options. The few lines of code in each file system didn't seem so bad especially if the show_function start echoing more. mark - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] disk quotas fail when /etc/mtab is symlinked to /proc/mounts
Mark Bellon <[EMAIL PROTECTED]> wrote: > > If /etc/mtab is a regular file all of the mount options (of a file > system) are written to /etc/mtab by the mount command. The quota tools > look there for the quota strings for their operation. If, however, > /etc/mtab is a symlink to /proc/mounts (a "good thing" in some > environments) the tools don't write anything - they assume the kernel > will take care of things. > > While the quota options are sent down to the kernel via the mount system > call and the file system codes handle them properly unfortunately there > is no code to echo the quota strings into /proc/mounts and the quota > tools fail in the symlink case. hm. Perhaps others with operational experience in that area can comment. > The attached patchs modify the EXT[2|3] and [X|J]FS codes to add the > necessary hooks. The show_options function of each file system in these > patches currently deal with only those things that seemed related to > quotas; especially in the EXT3 case more can be done (later?). It seems sad to do it in each filesystem. Is there no way in which we can do this for all filesystems, in a single place in the VFS? - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] disk quotas fail when /etc/mtab is symlinked to /proc/mounts
If /etc/mtab is a regular file all of the mount options (of a file system) are written to /etc/mtab by the mount command. The quota tools look there for the quota strings for their operation. If, however, /etc/mtab is a symlink to /proc/mounts (a "good thing" in some environments) the tools don't write anything - they assume the kernel will take care of things. While the quota options are sent down to the kernel via the mount system call and the file system codes handle them properly unfortunately there is no code to echo the quota strings into /proc/mounts and the quota tools fail in the symlink case. The attached patchs modify the EXT[2|3] and JFS codes to add the necessary hooks. The show_options function of each file system in these patches currently deal with only those things that seemed related to quotas; especially in the EXT3 case more can be done (later?). The original XFS change has been dropped as per Nathan Scott <[EMAIL PROTECTED]>. The functionality had already been added. The EXT3 has added error checking and has two minor changes: The "quota" option is considered part of the older style quotas Journalled quotas and older style quotas are mutually exclusive. - both discussable topics mark Signed-off-by: Mark Bellon <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] disk quotas fail when /etc/mtab is symlinked to /proc/mounts
Nathan Scott wrote: On Thu, Jul 28, 2005 at 05:03:02PM -0700, Mark Bellon wrote: The attached patchs modify the EXT[2|3] and [X|J]FS codes to add the The XFS component is incorrect, we're already doing this elsewhere (over in fs/xfs/quota/xfs_qm_bhv.c), so please drop this last part from your patch... No problem! New patch coming up. mark diff -Naur linux-2.6.13-rc3-git9-orig/fs/xfs/xfs_vfsops.c linux-2.6.13-rc3-git9/fs/xfs/xfs_vfsops.c ... + { XFS_UQUOTA_ACTIVE,"," "usrquota" }, + { XFS_GQUOTA_ACTIVE,"," "grpquota" }, thanks. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] disk quotas fail when /etc/mtab is symlinked to /proc/mounts
On Thu, Jul 28, 2005 at 05:03:02PM -0700, Mark Bellon wrote: > The attached patchs modify the EXT[2|3] and [X|J]FS codes to add the The XFS component is incorrect, we're already doing this elsewhere (over in fs/xfs/quota/xfs_qm_bhv.c), so please drop this last part from your patch... > diff -Naur linux-2.6.13-rc3-git9-orig/fs/xfs/xfs_vfsops.c > linux-2.6.13-rc3-git9/fs/xfs/xfs_vfsops.c > ... > + { XFS_UQUOTA_ACTIVE,"," "usrquota" }, > + { XFS_GQUOTA_ACTIVE,"," "grpquota" }, thanks. -- Nathan - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] disk quotas fail when /etc/mtab is symlinked to /proc/mounts
If /etc/mtab is a regular file all of the mount options (of a file system) are written to /etc/mtab by the mount command. The quota tools look there for the quota strings for their operation. If, however, /etc/mtab is a symlink to /proc/mounts (a "good thing" in some environments) the tools don't write anything - they assume the kernel will take care of things. While the quota options are sent down to the kernel via the mount system call and the file system codes handle them properly unfortunately there is no code to echo the quota strings into /proc/mounts and the quota tools fail in the symlink case. The attached patchs modify the EXT[2|3] and [X|J]FS codes to add the necessary hooks. The show_options function of each file system in these patches currently deal with only those things that seemed related to quotas; especially in the EXT3 case more can be done (later?). The EXT3 has added error checking and has two minor changes: The "quota" option is considered part of the older style quotas Journalled quotas and older style quotas are mutually exclusive. - both discussable topics mark Signed-off-by: Mark Bellon <[EMAIL PROTECTED]> diff -Naur linux-2.6.13-rc3-git9-orig/include/linux/ext3_fs.h linux-2.6.13-rc3-git9/include/linux/ext3_fs.h --- linux-2.6.13-rc3-git9-orig/include/linux/ext3_fs.h 2005-07-28 15:12:52.0 -0700 +++ linux-2.6.13-rc3-git9/include/linux/ext3_fs.h 2005-07-28 16:18:24.0 -0700 @@ -373,6 +373,8 @@ #define EXT3_MOUNT_BARRIER 0x2 /* Use block barriers */ #define EXT3_MOUNT_NOBH0x4 /* No bufferheads */ #define EXT3_MOUNT_QUOTA 0x8 /* Some quota option set */ +#define EXT3_MOUNT_USRQUOTA0x10 /* "old" user quota */ +#define EXT3_MOUNT_GRPQUOTA0x20 /* "old" group quota */ /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ #ifndef _LINUX_EXT2_FS_H diff -Naur linux-2.6.13-rc3-git9-orig/fs/ext3/super.c linux-2.6.13-rc3-git9/fs/ext3/super.c --- linux-2.6.13-rc3-git9-orig/fs/ext3/super.c 2005-07-28 15:12:51.0 -0700 +++ linux-2.6.13-rc3-git9/fs/ext3/super.c 2005-07-28 16:01:15.0 -0700 @@ -35,6 +35,7 @@ #include #include #include +#include #include #include "xattr.h" #include "acl.h" @@ -510,6 +511,37 @@ } #ifdef CONFIG_QUOTA +static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs) +{ + struct ext3_sb_info *sbi = EXT3_SB(vfs->mnt_sb); + + if (sbi->s_mount_opt & EXT3_MOUNT_JOURNAL_DATA) + seq_puts(seq, ",data=journal"); + + if (sbi->s_mount_opt & EXT3_MOUNT_ORDERED_DATA) + seq_puts(seq, ",data=ordered"); + + if (sbi->s_mount_opt & EXT3_MOUNT_WRITEBACK_DATA) + seq_puts(seq, ",data=writeback"); + + if (sbi->s_jquota_fmt) + seq_printf(seq, ",jqfmt=%s", + (sbi->s_jquota_fmt == QFMT_VFS_OLD) ? "vfsold": "vfsv0"); + + if (sbi->s_qf_names[USRQUOTA]) + seq_printf(seq, ",usrjquota=%s", sbi->s_qf_names[USRQUOTA]); + + if (sbi->s_qf_names[GRPQUOTA]) + seq_printf(seq, ",grpjquota=%s", sbi->s_qf_names[GRPQUOTA]); + + if (sbi->s_mount_opt & EXT3_MOUNT_USRQUOTA) + seq_puts(seq, ",usrquota"); + + if (sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA) + seq_puts(seq, ",grpquota"); + + return 0; +} #define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group") #define QTYPE2MOPT(on, t) ((t)==USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA)) @@ -572,6 +604,7 @@ #ifdef CONFIG_QUOTA .quota_read = ext3_quota_read, .quota_write= ext3_quota_write, + .show_options = ext3_show_options, #endif }; @@ -590,7 +623,8 @@ Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback, Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota, - Opt_ignore, Opt_barrier, Opt_err, Opt_resize, + Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota, + Opt_grpquota }; static match_table_t tokens = { @@ -634,10 +668,10 @@ {Opt_grpjquota, "grpjquota=%s"}, {Opt_jqfmt_vfsold, "jqfmt=vfsold"}, {Opt_jqfmt_vfsv0, "jqfmt=vfsv0"}, - {Opt_quota, "grpquota"}, + {Opt_grpquota, "grpquota"}, {Opt_noquota, "noquota"}, {Opt_quota, "quota"}, - {Opt_quota, "usrquota"}, + {Opt_usrquota, "usrquota"}, {Opt_barrier, "barrier=%u"}, {Opt_err, NULL}, {Opt_resize, "resize"}, @@ -902,8 +936,18 @@ case Opt_jqfmt_vfsv0: sbi->s_jquota_fmt = QFMT_VFS_V0; break; + case Opt_usrquota: + set_opt(sbi->s_mount_opt, QUOTA); + set_opt(sbi->s_mount_opt, USRQUOTA); + break; + case Opt