* 2.5.54 - quota support @ 2003-01-06 0:38 Lukas Hejtmanek 2003-01-06 1:59 ` Andrew Morton 0 siblings, 1 reply; 11+ messages in thread From: Lukas Hejtmanek @ 2003-01-06 0:38 UTC (permalink / raw) To: linux-kernel Hello, Is quota support currently broken? Under 2.5.54 I got: # quotaon / using //aquota.user on /dev/hda1: No such device /dev/hda1 is ext3 and aquota.user exists on it. My config is: CONFIG_QUOTA=y # CONFIG_QFMT_V1 is not set CONFIG_QFMT_V2=y CONFIG_QUOTACTL=y -- Lukáš Hejtmánek ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 2.5.54 - quota support 2003-01-06 0:38 2.5.54 - quota support Lukas Hejtmanek @ 2003-01-06 1:59 ` Andrew Morton 2003-01-06 10:36 ` Lukas Hejtmanek 0 siblings, 1 reply; 11+ messages in thread From: Andrew Morton @ 2003-01-06 1:59 UTC (permalink / raw) To: Lukas Hejtmanek, Jan Kara; +Cc: linux-kernel Lukas Hejtmanek wrote: > > Hello, > > Is quota support currently broken? > > Under 2.5.54 I got: > # quotaon / > using //aquota.user on /dev/hda1: No such device > > /dev/hda1 is ext3 and aquota.user exists on it. > > My config is: > CONFIG_QUOTA=y > # CONFIG_QFMT_V1 is not set > CONFIG_QFMT_V2=y > CONFIG_QUOTACTL=y > It works for me. grab-n-build quota-3.08 from http://sourceforge.net/projects/linuxquota # mke2fs -j /dev/sde5 # mount /dev/sde5 /mnt/sde5 -o quota # quotacheck -F vfsv0 /dev/sde5 # quotaon /dev/sde5 # cd /mnt/sde5 # tar xfz ~/linux-2.4.19.tar.gz # repquota /mnt/sde5 *** Report for user quotas on device /dev/sde5 Block grace time: 7days; Inode grace time: 7days Block limits File limits User used soft hard grace used soft hard grace ---------------------------------------------------------------------- root -- 32828 0 0 3 0 0 akpm -- 162104 0 0 11370 0 0 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 2.5.54 - quota support 2003-01-06 1:59 ` Andrew Morton @ 2003-01-06 10:36 ` Lukas Hejtmanek 2003-01-06 14:48 ` Jan Kara 0 siblings, 1 reply; 11+ messages in thread From: Lukas Hejtmanek @ 2003-01-06 10:36 UTC (permalink / raw) To: Andrew Morton; +Cc: Jan Kara, linux-kernel On Sun, Jan 05, 2003 at 05:59:12PM -0800, Andrew Morton wrote: > grab-n-build quota-3.08 from http://sourceforge.net/projects/linuxquota $ dpkg -l quota ii quota 3.08-1 > # quotacheck -F vfsv0 /dev/sde5 this one works ok. quotacheck -m -F vfsv0 / seems to be working > # quotaon /dev/sde5 quotaon / freezes process if system is up in normal mode. More over any process cannot read nor write to disk after that. sysrq-p shows cpu in idle only. when init=/bin/sh then it reports no such device. under 2.5.53 and 2.4.20 quotaon works ok. Under 2.5.53 quotaoff / reports some error - no such device or bad ioctl I cannot remember exactly but process does not freeze. mounts: /dev/hda1 on / type ext3 (rw,usrquota) proc on /proc type proc (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/hda3 on /home type ext3 (rw) /dev/hda4 on /opt type xfs (rw,osyncisosync) /dev/hdc2 on /opt/tmp type xfs (rw,osyncisosync) /opt/run/usr on /usr type bind (rw,bind) none on /dev/shm type tmpfs (rw) automount(pid266) on /var/autofs/misc type autofs (rw,fd=5,pgrp=266,minproto=2,maxproto=4) automount(pid271) on /var/autofs/net type autofs (rw,fd=5,pgrp=271,minproto=2,maxproto=4) Here's my whole config: CONFIG_X86=y CONFIG_MMU=y CONFIG_SWAP=y CONFIG_UID16=y CONFIG_GENERIC_ISA_DMA=y CONFIG_EXPERIMENTAL=y CONFIG_SYSVIPC=y CONFIG_SYSCTL=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y CONFIG_OBSOLETE_MODPARM=y CONFIG_KMOD=y CONFIG_X86_PC=y CONFIG_MK7=y CONFIG_X86_CMPXCHG=y CONFIG_X86_XADD=y CONFIG_X86_L1_CACHE_SHIFT=6 CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_INVLPG=y CONFIG_X86_BSWAP=y CONFIG_X86_POPAD_OK=y CONFIG_X86_TSC=y CONFIG_X86_GOOD_APIC=y CONFIG_X86_USE_PPRO_CHECKSUM=y CONFIG_X86_USE_3DNOW=y CONFIG_PREEMPT=y CONFIG_EDD=y CONFIG_NOHIGHMEM=y CONFIG_MTRR=y CONFIG_HAVE_DEC_LOCK=y CONFIG_PCI=y CONFIG_PCI_GOANY=y CONFIG_PCI_BIOS=y CONFIG_PCI_DIRECT=y CONFIG_PCI_NAMES=y CONFIG_KCORE_ELF=y CONFIG_BINFMT_ELF=y CONFIG_BINFMT_MISC=y CONFIG_BLK_DEV_LOOP=m CONFIG_IDE=y CONFIG_BLK_DEV_IDE=y CONFIG_BLK_DEV_IDEDISK=y CONFIG_IDEDISK_MULTI_MODE=y CONFIG_BLK_DEV_IDECD=y CONFIG_BLK_DEV_IDESCSI=y CONFIG_BLK_DEV_IDEPCI=y CONFIG_BLK_DEV_GENERIC=y CONFIG_IDEPCI_SHARE_IRQ=y CONFIG_BLK_DEV_IDEDMA_PCI=y CONFIG_BLK_DEV_OFFBOARD=y CONFIG_IDEDMA_PCI_AUTO=y CONFIG_BLK_DEV_IDEDMA=y CONFIG_IDEDMA_PCI_WIP=y CONFIG_BLK_DEV_ADMA=y CONFIG_BLK_DEV_PDC202XX_OLD=y CONFIG_BLK_DEV_VIA82CXXX=y CONFIG_IDEDMA_AUTO=y CONFIG_BLK_DEV_PDC202XX=y CONFIG_BLK_DEV_IDE_MODES=y CONFIG_SCSI=y CONFIG_BLK_DEV_SD=y CONFIG_BLK_DEV_SR=y CONFIG_BLK_DEV_SR_VENDOR=y CONFIG_CHR_DEV_SG=y CONFIG_NET=y CONFIG_PACKET=y CONFIG_NETFILTER=y CONFIG_FILTER=y CONFIG_UNIX=y CONFIG_INET=y CONFIG_IP_MULTICAST=y CONFIG_SYN_COOKIES=y CONFIG_IP_NF_CONNTRACK=y CONFIG_IP_NF_FTP=y CONFIG_IP_NF_IPTABLES=y CONFIG_IP_NF_FILTER=y CONFIG_IP_NF_NAT=y CONFIG_IP_NF_NAT_NEEDED=y CONFIG_IP_NF_TARGET_MASQUERADE=y CONFIG_IP_NF_NAT_FTP=y CONFIG_IPV6=y CONFIG_IP6_NF_IPTABLES=y CONFIG_IP6_NF_FILTER=y CONFIG_IPV6_SCTP__=y CONFIG_NETDEVICES=y CONFIG_NET_ETHERNET=y CONFIG_NET_PCI=y CONFIG_E100=y CONFIG_8139TOO=y CONFIG_INPUT=y CONFIG_INPUT_MOUSEDEV=y CONFIG_INPUT_MOUSEDEV_PSAUX=y CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 CONFIG_SOUND_GAMEPORT=y CONFIG_SERIO=y CONFIG_SERIO_I8042=y CONFIG_INPUT_KEYBOARD=y CONFIG_KEYBOARD_ATKBD=y CONFIG_INPUT_MOUSE=y CONFIG_MOUSE_PS2=y CONFIG_VT=y CONFIG_VT_CONSOLE=y CONFIG_HW_CONSOLE=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_CORE=y CONFIG_UNIX98_PTYS=y CONFIG_UNIX98_PTY_COUNT=256 CONFIG_RTC=y CONFIG_AGP=y CONFIG_AGP_VIA=y CONFIG_QUOTA=y CONFIG_QFMT_V2=y CONFIG_QUOTACTL=y CONFIG_AUTOFS4_FS=y CONFIG_EXT3_FS=y CONFIG_EXT3_FS_XATTR=y CONFIG_JBD=y CONFIG_FAT_FS=m CONFIG_MSDOS_FS=m CONFIG_VFAT_FS=m CONFIG_TMPFS=y CONFIG_RAMFS=y CONFIG_ISO9660_FS=y CONFIG_JOLIET=y CONFIG_PROC_FS=y CONFIG_DEVPTS_FS=y CONFIG_EXT2_FS=y CONFIG_UDF_FS=y CONFIG_XFS_FS=y CONFIG_SMB_FS=y CONFIG_SMB_NLS_DEFAULT=y CONFIG_SMB_NLS_REMOTE="cp850" CONFIG_FS_MBCACHE=y CONFIG_MSDOS_PARTITION=y CONFIG_SMB_NLS=y CONFIG_NLS=y CONFIG_NLS_DEFAULT="iso8859-1" CONFIG_NLS_CODEPAGE_437=m CONFIG_NLS_CODEPAGE_850=m CONFIG_NLS_CODEPAGE_852=m CONFIG_NLS_ISO8859_1=m CONFIG_NLS_ISO8859_2=m CONFIG_NLS_UTF8=m CONFIG_VIDEO_SELECT=y CONFIG_VGA_CONSOLE=y CONFIG_DUMMY_CONSOLE=y CONFIG_SOUND=y CONFIG_SOUND_PRIME=y CONFIG_SOUND_EMU10K1=y CONFIG_MIDI_EMU10K1=y CONFIG_USB=y CONFIG_USB_DEVICEFS=y CONFIG_USB_UHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_DEBUG_KERNEL=y CONFIG_MAGIC_SYSRQ=y CONFIG_KALLSYMS=y CONFIG_CRYPTO=y CONFIG_CRYPTO_SHA1=y CONFIG_CRC32=y CONFIG_X86_BIOS_REBOOT=y -- Lukáš Hejtmánek ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 2.5.54 - quota support 2003-01-06 10:36 ` Lukas Hejtmanek @ 2003-01-06 14:48 ` Jan Kara 2003-01-06 15:19 ` Lukas Hejtmanek 0 siblings, 1 reply; 11+ messages in thread From: Jan Kara @ 2003-01-06 14:48 UTC (permalink / raw) To: Lukas Hejtmanek; +Cc: Andrew Morton, linux-kernel Hello, > On Sun, Jan 05, 2003 at 05:59:12PM -0800, Andrew Morton wrote: > > grab-n-build quota-3.08 from http://sourceforge.net/projects/linuxquota > > $ dpkg -l quota > ii quota 3.08-1 > > > # quotacheck -F vfsv0 /dev/sde5 > > this one works ok. quotacheck -m -F vfsv0 / seems to be working > > > # quotaon /dev/sde5 > > quotaon / freezes process if system is up in normal mode. More over any process > cannot read nor write to disk after that. sysrq-p shows cpu in idle only. I seems like quotaon (or better quotactl()) waits on some lock forever... I'll try to reproduce it but in the mean time can you print list of processes, write down a few addresses from the top of the stack of quotaon and try to match it in the system.map to function in which is process stuck? > when init=/bin/sh then it reports no such device. Hmm.. This might be helpful. Thanks. > under 2.5.53 and 2.4.20 quotaon works ok. Under 2.5.53 quotaoff / reports some > error - no such device or bad ioctl I cannot remember exactly but process does > not freeze. Thanks for report Honza ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 2.5.54 - quota support 2003-01-06 14:48 ` Jan Kara @ 2003-01-06 15:19 ` Lukas Hejtmanek 2003-01-07 16:40 ` Jan Kara 0 siblings, 1 reply; 11+ messages in thread From: Lukas Hejtmanek @ 2003-01-06 15:19 UTC (permalink / raw) To: Jan Kara; +Cc: Andrew Morton, linux-kernel On Mon, Jan 06, 2003 at 03:48:43PM +0100, Jan Kara wrote: > I seems like quotaon (or better quotactl()) waits on some lock > forever... I'll try to reproduce it but in the mean time can you print > list of processes, write down a few addresses from the top of the stack > of quotaon and try to match it in the system.map to function in which > is process stuck? according to strace quotaon freezes at quotactl(0xff800002, "/dev/hda1", 2 call trace is: (sysrq-t) vfs_permission __rwsem_do_wake rwsem_down_read_failed module_put dqinit_needed vfs_quota_off resolve_dev d_free deny_write_access check_quotactl_valid d_free scheduling_functions_start_here do_quotactl system_call Btw, freeze on quotaon is not regular. After some time that system is up, quotaon reports only no such device and terminates. so looks like 1) freeze on quotactl 2) reports no such device in both cases not working. -- Lukáš Hejtmánek ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 2.5.54 - quota support 2003-01-06 15:19 ` Lukas Hejtmanek @ 2003-01-07 16:40 ` Jan Kara 2003-01-08 1:21 ` Lukas Hejtmanek 0 siblings, 1 reply; 11+ messages in thread From: Jan Kara @ 2003-01-07 16:40 UTC (permalink / raw) To: Lukas Hejtmanek; +Cc: Andrew Morton, linux-kernel [-- Attachment #1: Type: text/plain, Size: 1389 bytes --] > On Mon, Jan 06, 2003 at 03:48:43PM +0100, Jan Kara wrote: > > I seems like quotaon (or better quotactl()) waits on some lock > > forever... I'll try to reproduce it but in the mean time can you print > > list of processes, write down a few addresses from the top of the stack > > of quotaon and try to match it in the system.map to function in which > > is process stuck? > > according to strace quotaon freezes at > quotactl(0xff800002, "/dev/hda1", 2 > > call trace is: (sysrq-t) > vfs_permission > __rwsem_do_wake > rwsem_down_read_failed > module_put > dqinit_needed > vfs_quota_off > resolve_dev > d_free > deny_write_access > check_quotactl_valid > d_free > scheduling_functions_start_here > do_quotactl > system_call > > > Btw, freeze on quotaon is not regular. After some time that system is up, > quotaon reports only no such device and terminates. > > so looks like > 1) freeze on quotactl > 2) reports no such device > > in both cases not working. Reporting 'No such device' was actually bug which was introduced some time ago but nobody probably noticed it... It was introduce when quota code was converted from device numbers to 'bdev' structures. I also fixed one bug in quotaon() call however I'm not sure wheter it could cause the freeze. Anyway patch is attached, try it and tell me about the changes. Honza -- Jan Kara <jack@suse.cz> SuSE CR Labs [-- Attachment #2: quota-2.5.54-1-fix.diff --] [-- Type: text/plain, Size: 1723 bytes --] diff -ruNX /home/jack/.kerndiffexclude linux-2.5.54/fs/dquot.c linux-2.5.54-1-lockfix/fs/dquot.c --- linux-2.5.54/fs/dquot.c Mon Jan 6 21:54:10 2003 +++ linux-2.5.54-1-lockfix/fs/dquot.c Mon Jan 6 23:49:43 2003 @@ -1157,6 +1157,7 @@ struct quota_info *dqopt = sb_dqopt(sb); struct quota_format_type *fmt = find_quota_format(format_id); int error; + unsigned int oldflags; if (!fmt) return -ESRCH; @@ -1181,10 +1182,11 @@ error = -EBUSY; goto out_lock; } + oldflags = inode->i_flags; dqopt->files[type] = f; error = -EINVAL; if (!fmt->qf_ops->check_quota_file(sb, type)) - goto out_lock; + goto out_file_init; /* We don't want quota on quota files */ dquot_drop_nolock(inode); inode->i_flags |= S_NOQUOTA; @@ -1194,7 +1196,7 @@ down(&dqopt->dqio_sem); if ((error = dqopt->ops[type]->read_file_info(sb, type)) < 0) { up(&dqopt->dqio_sem); - goto out_lock; + goto out_file_init; } up(&dqopt->dqio_sem); set_enable_flags(dqopt, type); @@ -1204,9 +1206,10 @@ up_write(&dqopt->dqoff_sem); return 0; -out_lock: - inode->i_flags &= ~S_NOQUOTA; +out_file_init: + inode->i_flags = oldflags; dqopt->files[type] = NULL; +out_lock: up_write(&dqopt->dqoff_sem); out_f: filp_close(f, NULL); diff -ruNX /home/jack/.kerndiffexclude linux-2.5.54/fs/quota.c linux-2.5.54-1-lockfix/fs/quota.c --- linux-2.5.54/fs/quota.c Tue Jan 7 00:47:58 2003 +++ linux-2.5.54-1-lockfix/fs/quota.c Tue Jan 7 00:49:23 2003 @@ -114,7 +114,11 @@ ret = user_path_walk(path, &nd); if (ret) goto out; - + ret = bd_acquire(nd.dentry->d_inode); + if (ret) { + path_release(&nd); + goto out; + } bdev = nd.dentry->d_inode->i_bdev; mode = nd.dentry->d_inode->i_mode; path_release(&nd); ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 2.5.54 - quota support 2003-01-07 16:40 ` Jan Kara @ 2003-01-08 1:21 ` Lukas Hejtmanek 2003-01-08 10:22 ` Miquel van Smoorenburg ` (2 more replies) 0 siblings, 3 replies; 11+ messages in thread From: Lukas Hejtmanek @ 2003-01-08 1:21 UTC (permalink / raw) To: Jan Kara; +Cc: Andrew Morton, linux-kernel On Tue, Jan 07, 2003 at 05:40:28PM +0100, Jan Kara wrote: > Reporting 'No such device' was actually bug which was introduced some > time ago but nobody probably noticed it... It was introduce when quota > code was converted from device numbers to 'bdev' structures. > I also fixed one bug in quotaon() call however I'm not sure wheter it > could cause the freeze. Anyway patch is attached, try it and tell me > about the changes. Hmm, quotaon / with init=/bin/sh seems to work OK, quota accounting is made and repquota displays normal info. However with normal startup quotaon / still freezes :-( Btw, does anyone know why mount is failing for so long time while using with automount? Process mount is in uninterruptible sleep for more than 10 secs until reports no disc in cdrom. (the same for my usb camera when autofs try to mount it while it is not connected). -- Lukáš Hejtmánek ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 2.5.54 - quota support 2003-01-08 1:21 ` Lukas Hejtmanek @ 2003-01-08 10:22 ` Miquel van Smoorenburg 2003-01-08 10:56 ` Jan Kara 2003-01-10 19:32 ` Jan Kara 2 siblings, 0 replies; 11+ messages in thread From: Miquel van Smoorenburg @ 2003-01-08 10:22 UTC (permalink / raw) To: linux-kernel In article <20030108012133.GA725@mail.muni.cz>, Lukas Hejtmanek <xhejtman@mail.muni.cz> wrote: >On Tue, Jan 07, 2003 at 05:40:28PM +0100, Jan Kara wrote: >> Reporting 'No such device' was actually bug which was introduced some >> time ago but nobody probably noticed it... It was introduce when quota >> code was converted from device numbers to 'bdev' structures. >> I also fixed one bug in quotaon() call however I'm not sure wheter it >> could cause the freeze. Anyway patch is attached, try it and tell me >> about the changes. > >Hmm, quotaon / with init=/bin/sh seems to work OK, quota accounting is made and >repquota displays normal info. > >However with normal startup quotaon / still freezes :-( ulimit ? Mike. -- They all laughed when I said I wanted to build a joke-telling machine. Well, I showed them! Nobody's laughing *now*! -- acesteves@clix.pt ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 2.5.54 - quota support 2003-01-08 1:21 ` Lukas Hejtmanek 2003-01-08 10:22 ` Miquel van Smoorenburg @ 2003-01-08 10:56 ` Jan Kara 2003-01-10 19:32 ` Jan Kara 2 siblings, 0 replies; 11+ messages in thread From: Jan Kara @ 2003-01-08 10:56 UTC (permalink / raw) To: Lukas Hejtmanek; +Cc: Andrew Morton, linux-kernel > On Tue, Jan 07, 2003 at 05:40:28PM +0100, Jan Kara wrote: > > Reporting 'No such device' was actually bug which was introduced some > > time ago but nobody probably noticed it... It was introduce when quota > > code was converted from device numbers to 'bdev' structures. > > I also fixed one bug in quotaon() call however I'm not sure wheter it > > could cause the freeze. Anyway patch is attached, try it and tell me > > about the changes. > > Hmm, quotaon / with init=/bin/sh seems to work OK, quota accounting is made and > repquota displays normal info. OK, so one bug fixed. > However with normal startup quotaon / still freezes :-( :( So I'll search for more bugs... > Btw, does anyone know why mount is failing for so long time while using with > automount? Process mount is in uninterruptible sleep for more than 10 secs until > reports no disc in cdrom. (the same for my usb camera when autofs try to mount > it while it is not connected). Honza -- Jan Kara <jack@suse.cz> SuSE CR Labs ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 2.5.54 - quota support 2003-01-08 1:21 ` Lukas Hejtmanek 2003-01-08 10:22 ` Miquel van Smoorenburg 2003-01-08 10:56 ` Jan Kara @ 2003-01-10 19:32 ` Jan Kara 2003-01-12 21:20 ` Lukas Hejtmanek 2 siblings, 1 reply; 11+ messages in thread From: Jan Kara @ 2003-01-10 19:32 UTC (permalink / raw) To: Lukas Hejtmanek; +Cc: Andrew Morton, linux-kernel [-- Attachment #1: Type: text/plain, Size: 1052 bytes --] > On Tue, Jan 07, 2003 at 05:40:28PM +0100, Jan Kara wrote: > > Reporting 'No such device' was actually bug which was introduced some > > time ago but nobody probably noticed it... It was introduce when quota > > code was converted from device numbers to 'bdev' structures. > > I also fixed one bug in quotaon() call however I'm not sure wheter it > > could cause the freeze. Anyway patch is attached, try it and tell me > > about the changes. > > Hmm, quotaon / with init=/bin/sh seems to work OK, quota accounting is made and > repquota displays normal info. > > However with normal startup quotaon / still freezes :-( Ok. So I found the bug. Fix was a bit nontrivial (at one path we tried to acquire one lock twice) but know it should work. The patch also contain fix in ext2 - at some time ext2_setattr was written and call of DQUOT_TRANSFER was missing so no quota was being transferred. Please test whether the patch works for you. Honza PS: First patch is the one I already sent you. -- Jan Kara <jack@suse.cz> SuSE CR Labs [-- Attachment #2: quota-2.5.54-1-lockfix.diff --] [-- Type: text/plain, Size: 1723 bytes --] diff -ruNX /home/jack/.kerndiffexclude linux-2.5.54/fs/dquot.c linux-2.5.54-1-lockfix/fs/dquot.c --- linux-2.5.54/fs/dquot.c Mon Jan 6 21:54:10 2003 +++ linux-2.5.54-1-lockfix/fs/dquot.c Thu Jan 9 10:10:55 2003 @@ -1157,6 +1157,7 @@ struct quota_info *dqopt = sb_dqopt(sb); struct quota_format_type *fmt = find_quota_format(format_id); int error; + unsigned int oldflags; if (!fmt) return -ESRCH; @@ -1181,10 +1182,11 @@ error = -EBUSY; goto out_lock; } + oldflags = inode->i_flags; dqopt->files[type] = f; error = -EINVAL; if (!fmt->qf_ops->check_quota_file(sb, type)) - goto out_lock; + goto out_file_init; /* We don't want quota on quota files */ dquot_drop_nolock(inode); inode->i_flags |= S_NOQUOTA; @@ -1194,7 +1196,7 @@ down(&dqopt->dqio_sem); if ((error = dqopt->ops[type]->read_file_info(sb, type)) < 0) { up(&dqopt->dqio_sem); - goto out_lock; + goto out_file_init; } up(&dqopt->dqio_sem); set_enable_flags(dqopt, type); @@ -1204,9 +1206,10 @@ up_write(&dqopt->dqoff_sem); return 0; -out_lock: - inode->i_flags &= ~S_NOQUOTA; +out_file_init: + inode->i_flags = oldflags; dqopt->files[type] = NULL; +out_lock: up_write(&dqopt->dqoff_sem); out_f: filp_close(f, NULL); diff -ruNX /home/jack/.kerndiffexclude linux-2.5.54/fs/quota.c linux-2.5.54-1-lockfix/fs/quota.c --- linux-2.5.54/fs/quota.c Tue Jan 7 00:47:58 2003 +++ linux-2.5.54-1-lockfix/fs/quota.c Thu Jan 9 10:11:15 2003 @@ -114,7 +114,11 @@ ret = user_path_walk(path, &nd); if (ret) goto out; - + ret = bd_acquire(nd.dentry->d_inode); + if (ret) { + path_release(&nd); + goto out; + } bdev = nd.dentry->d_inode->i_bdev; mode = nd.dentry->d_inode->i_mode; path_release(&nd); [-- Attachment #3: quota-2.5.54-2-offsem.diff --] [-- Type: text/plain, Size: 12420 bytes --] diff -ruNX /home/jack/.kerndiffexclude linux-2.5.54-1-lockfix/fs/dquot.c linux-2.5.54-2-offsem/fs/dquot.c --- linux-2.5.54-1-lockfix/fs/dquot.c Thu Jan 9 10:10:55 2003 +++ linux-2.5.54-2-offsem/fs/dquot.c Fri Jan 10 01:08:57 2003 @@ -159,7 +159,7 @@ * Note that any operation which operates on dquot data (ie. dq_dqb) must * hold dq_data_lock. * - * Any operation working with dquots must hold dqoff_sem. If operation is + * Any operation working with dquots must hold dqptr_sem. If operation is * just reading pointers from inodes than read lock is enough. If pointers * are altered function must hold write lock. * @@ -270,7 +270,7 @@ } /* Invalidate all dquots on the list. Note that this function is called after - * quota is disabled so no new quota might be created. Because we hold dqoff_sem + * quota is disabled so no new quota might be created. Because we hold dqptr_sem * for writing and pointers were already removed from inodes we actually know that * no quota for this sb+type should be held. */ static void invalidate_dquots(struct super_block *sb, int type) @@ -287,7 +287,7 @@ if (dquot->dq_type != type) continue; #ifdef __DQUOT_PARANOIA - /* There should be no users of quota - we hold dqoff_sem for writing */ + /* There should be no users of quota - we hold dqptr_sem for writing */ if (atomic_read(&dquot->dq_count)) BUG(); #endif @@ -307,7 +307,7 @@ struct quota_info *dqopt = sb_dqopt(sb); int cnt; - down_read(&dqopt->dqoff_sem); + down_read(&dqopt->dqptr_sem); restart: /* At this point any dirty dquot will definitely be written so we can clear dirty flag from info */ @@ -340,7 +340,7 @@ spin_lock(&dq_list_lock); dqstats.syncs++; spin_unlock(&dq_list_lock); - up_read(&dqopt->dqoff_sem); + up_read(&dqopt->dqptr_sem); return 0; } @@ -427,7 +427,7 @@ /* * Put reference to dquot * NOTE: If you change this function please check whether dqput_blocks() works right... - * MUST be called with dqoff_sem held + * MUST be called with dqptr_sem held */ static void dqput(struct dquot *dquot) { @@ -492,7 +492,7 @@ /* * Get reference to dquot - * MUST be called with dqoff_sem held + * MUST be called with dqptr_sem held */ static struct dquot *dqget(struct super_block *sb, unsigned int id, int type) { @@ -553,7 +553,7 @@ return 0; } -/* This routine is guarded by dqoff_sem semaphore */ +/* This routine is guarded by dqptr_sem semaphore */ static void add_dquot_ref(struct super_block *sb, int type) { struct list_head *p; @@ -586,7 +586,7 @@ } /* Remove references to dquots from inode - add dquot to list for freeing if needed */ -/* We can't race with anybody because we hold dqoff_sem for writing... */ +/* We can't race with anybody because we hold dqptr_sem for writing... */ int remove_inode_dquot_ref(struct inode *inode, int type, struct list_head *tofree_head) { struct dquot *dquot = inode->i_dquot[type]; @@ -829,10 +829,10 @@ unsigned int id = 0; int cnt; - down_write(&sb_dqopt(inode->i_sb)->dqoff_sem); - /* Having dqoff lock we know NOQUOTA flags can't be altered... */ + down_write(&sb_dqopt(inode->i_sb)->dqptr_sem); + /* Having dqptr_sem we know NOQUOTA flags can't be altered... */ if (IS_NOQUOTA(inode)) { - up_write(&sb_dqopt(inode->i_sb)->dqoff_sem); + up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); return; } /* Build list of quotas to initialize... */ @@ -853,7 +853,7 @@ inode->i_flags |= S_QUOTA; } } - up_write(&sb_dqopt(inode->i_sb)->dqoff_sem); + up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); } /* @@ -876,9 +876,9 @@ void dquot_drop(struct inode *inode) { - down_write(&sb_dqopt(inode->i_sb)->dqoff_sem); + down_write(&sb_dqopt(inode->i_sb)->dqptr_sem); dquot_drop_nolock(inode); - up_write(&sb_dqopt(inode->i_sb)->dqoff_sem); + up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); } /* @@ -892,7 +892,7 @@ for (cnt = 0; cnt < MAXQUOTAS; cnt++) warntype[cnt] = NOWARN; - down_read(&sb_dqopt(inode->i_sb)->dqoff_sem); + down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); spin_lock(&dq_data_lock); for (cnt = 0; cnt < MAXQUOTAS; cnt++) { if (inode->i_dquot[cnt] == NODQUOT) @@ -910,7 +910,7 @@ warn_put_all: spin_unlock(&dq_data_lock); flush_warnings(inode->i_dquot, warntype); - up_read(&sb_dqopt(inode->i_sb)->dqoff_sem); + up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); return ret; } @@ -924,7 +924,7 @@ for (cnt = 0; cnt < MAXQUOTAS; cnt++) warntype[cnt] = NOWARN; - down_read(&sb_dqopt(inode->i_sb)->dqoff_sem); + down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); spin_lock(&dq_data_lock); for (cnt = 0; cnt < MAXQUOTAS; cnt++) { if (inode->i_dquot[cnt] == NODQUOT) @@ -942,7 +942,7 @@ warn_put_all: spin_unlock(&dq_data_lock); flush_warnings((struct dquot **)inode->i_dquot, warntype); - up_read(&sb_dqopt(inode->i_sb)->dqoff_sem); + up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); return ret; } @@ -953,7 +953,7 @@ { unsigned int cnt; - down_read(&sb_dqopt(inode->i_sb)->dqoff_sem); + down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); spin_lock(&dq_data_lock); for (cnt = 0; cnt < MAXQUOTAS; cnt++) { if (inode->i_dquot[cnt] == NODQUOT) @@ -962,7 +962,7 @@ } inode_sub_bytes(inode, number); spin_unlock(&dq_data_lock); - up_read(&sb_dqopt(inode->i_sb)->dqoff_sem); + up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); } /* @@ -972,7 +972,7 @@ { unsigned int cnt; - down_read(&sb_dqopt(inode->i_sb)->dqoff_sem); + down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); spin_lock(&dq_data_lock); for (cnt = 0; cnt < MAXQUOTAS; cnt++) { if (inode->i_dquot[cnt] == NODQUOT) @@ -980,7 +980,7 @@ dquot_decr_inodes(inode->i_dquot[cnt], number); } spin_unlock(&dq_data_lock); - up_read(&sb_dqopt(inode->i_sb)->dqoff_sem); + up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); } /* @@ -1002,7 +1002,7 @@ transfer_to[cnt] = transfer_from[cnt] = NODQUOT; warntype[cnt] = NOWARN; } - down_write(&sb_dqopt(inode->i_sb)->dqoff_sem); + down_write(&sb_dqopt(inode->i_sb)->dqptr_sem); if (IS_NOQUOTA(inode)) /* File without quota accounting? */ goto warn_put_all; /* First build the transfer_to list - here we can block on reading of dquots... */ @@ -1058,7 +1058,7 @@ for (cnt = 0; cnt < MAXQUOTAS; cnt++) if (transfer_from[cnt] != NODQUOT) dqput(transfer_from[cnt]); - up_write(&sb_dqopt(inode->i_sb)->dqoff_sem); + up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); return ret; } @@ -1114,7 +1114,8 @@ goto out; /* We need to serialize quota_off() for device */ - down_write(&dqopt->dqoff_sem); + down(&dqopt->dqonoff_sem); + down_write(&dqopt->dqptr_sem); for (cnt = 0; cnt < MAXQUOTAS; cnt++) { if (type != -1 && cnt != type) continue; @@ -1145,7 +1146,8 @@ dqopt->info[cnt].dqi_bgrace = 0; dqopt->ops[cnt] = NULL; } - up_write(&dqopt->dqoff_sem); + up_write(&dqopt->dqptr_sem); + up(&dqopt->dqonoff_sem); out: return 0; } @@ -1177,7 +1179,8 @@ if (!S_ISREG(inode->i_mode)) goto out_f; - down_write(&dqopt->dqoff_sem); + down(&dqopt->dqonoff_sem); + down_write(&dqopt->dqptr_sem); if (sb_has_quota_enabled(sb, type)) { error = -EBUSY; goto out_lock; @@ -1200,17 +1203,19 @@ } up(&dqopt->dqio_sem); set_enable_flags(dqopt, type); + up_write(&dqopt->dqptr_sem); add_dquot_ref(sb, type); + up(&dqopt->dqonoff_sem); - up_write(&dqopt->dqoff_sem); return 0; out_file_init: inode->i_flags = oldflags; dqopt->files[type] = NULL; out_lock: - up_write(&dqopt->dqoff_sem); + up_write(&dqopt->dqptr_sem); + up(&dqopt->dqonoff_sem); out_f: filp_close(f, NULL); out_fmt: @@ -1241,14 +1246,14 @@ { struct dquot *dquot; - down_read(&sb_dqopt(sb)->dqoff_sem); + down_read(&sb_dqopt(sb)->dqptr_sem); if (!(dquot = dqget(sb, id, type))) { - up_read(&sb_dqopt(sb)->dqoff_sem); + up_read(&sb_dqopt(sb)->dqptr_sem); return -ESRCH; } do_get_dqblk(dquot, di); dqput(dquot); - up_read(&sb_dqopt(sb)->dqoff_sem); + up_read(&sb_dqopt(sb)->dqptr_sem); return 0; } @@ -1310,14 +1315,14 @@ { struct dquot *dquot; - down_read(&sb_dqopt(sb)->dqoff_sem); + down_read(&sb_dqopt(sb)->dqptr_sem); if (!(dquot = dqget(sb, id, type))) { - up_read(&sb_dqopt(sb)->dqoff_sem); + up_read(&sb_dqopt(sb)->dqptr_sem); return -ESRCH; } do_set_dqblk(dquot, di); dqput(dquot); - up_read(&sb_dqopt(sb)->dqoff_sem); + up_read(&sb_dqopt(sb)->dqptr_sem); return 0; } @@ -1326,9 +1331,9 @@ { struct mem_dqinfo *mi; - down_read(&sb_dqopt(sb)->dqoff_sem); + down_read(&sb_dqopt(sb)->dqptr_sem); if (!sb_has_quota_enabled(sb, type)) { - up_read(&sb_dqopt(sb)->dqoff_sem); + up_read(&sb_dqopt(sb)->dqptr_sem); return -ESRCH; } mi = sb_dqopt(sb)->info + type; @@ -1338,7 +1343,7 @@ ii->dqi_flags = mi->dqi_flags & DQF_MASK; ii->dqi_valid = IIF_ALL; spin_unlock(&dq_data_lock); - up_read(&sb_dqopt(sb)->dqoff_sem); + up_read(&sb_dqopt(sb)->dqptr_sem); return 0; } @@ -1347,9 +1352,9 @@ { struct mem_dqinfo *mi; - down_read(&sb_dqopt(sb)->dqoff_sem); + down_read(&sb_dqopt(sb)->dqptr_sem); if (!sb_has_quota_enabled(sb, type)) { - up_read(&sb_dqopt(sb)->dqoff_sem); + up_read(&sb_dqopt(sb)->dqptr_sem); return -ESRCH; } mi = sb_dqopt(sb)->info + type; @@ -1362,7 +1367,7 @@ mi->dqi_flags = (mi->dqi_flags & ~DQF_MASK) | (ii->dqi_flags & DQF_MASK); mark_info_dirty(mi); spin_unlock(&dq_data_lock); - up_read(&sb_dqopt(sb)->dqoff_sem); + up_read(&sb_dqopt(sb)->dqptr_sem); return 0; } diff -ruNX /home/jack/.kerndiffexclude linux-2.5.54-1-lockfix/fs/ext2/inode.c linux-2.5.54-2-offsem/fs/ext2/inode.c --- linux-2.5.54-1-lockfix/fs/ext2/inode.c Mon Jan 6 21:53:37 2003 +++ linux-2.5.54-2-offsem/fs/ext2/inode.c Fri Jan 10 01:04:02 2003 @@ -1238,6 +1238,12 @@ error = inode_change_ok(inode, iattr); if (error) return error; + if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || + (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { + error = DQUOT_TRANSFER(inode, iattr) ? -EDQUOT : 0; + if (error) + return error; + } inode_setattr(inode, iattr); if (iattr->ia_valid & ATTR_MODE) error = ext2_acl_chmod(inode); diff -ruNX /home/jack/.kerndiffexclude linux-2.5.54-1-lockfix/fs/quota.c linux-2.5.54-2-offsem/fs/quota.c --- linux-2.5.54-1-lockfix/fs/quota.c Thu Jan 9 10:11:15 2003 +++ linux-2.5.54-2-offsem/fs/quota.c Thu Jan 9 23:27:24 2003 @@ -156,13 +156,13 @@ case Q_GETFMT: { __u32 fmt; - down_read(&sb_dqopt(sb)->dqoff_sem); + down_read(&sb_dqopt(sb)->dqptr_sem); if (!sb_has_quota_enabled(sb, type)) { - up_read(&sb_dqopt(sb)->dqoff_sem); + up_read(&sb_dqopt(sb)->dqptr_sem); return -ESRCH; } fmt = sb_dqopt(sb)->info[type].dqi_format->qf_fmt_id; - up_read(&sb_dqopt(sb)->dqoff_sem); + up_read(&sb_dqopt(sb)->dqptr_sem); if (copy_to_user(addr, &fmt, sizeof(fmt))) return -EFAULT; return 0; diff -ruNX /home/jack/.kerndiffexclude linux-2.5.54-1-lockfix/fs/super.c linux-2.5.54-2-offsem/fs/super.c --- linux-2.5.54-1-lockfix/fs/super.c Mon Jan 6 21:54:11 2003 +++ linux-2.5.54-2-offsem/fs/super.c Thu Jan 9 23:26:50 2003 @@ -71,7 +71,8 @@ atomic_set(&s->s_active, 1); sema_init(&s->s_vfs_rename_sem,1); sema_init(&s->s_dquot.dqio_sem, 1); - init_rwsem(&s->s_dquot.dqoff_sem); + sema_init(&s->s_dquot.dqonoff_sem, 1); + init_rwsem(&s->s_dquot.dqptr_sem); s->s_maxbytes = MAX_NON_LFS; s->dq_op = sb_dquot_ops; s->s_qcop = sb_quotactl_ops; diff -ruNX /home/jack/.kerndiffexclude linux-2.5.54-1-lockfix/include/linux/quota.h linux-2.5.54-2-offsem/include/linux/quota.h --- linux-2.5.54-1-lockfix/include/linux/quota.h Mon Jan 6 21:54:13 2003 +++ linux-2.5.54-2-offsem/include/linux/quota.h Thu Jan 9 23:25:05 2003 @@ -280,7 +280,8 @@ struct quota_info { unsigned int flags; /* Flags for diskquotas on this device */ struct semaphore dqio_sem; /* lock device while I/O in progress */ - struct rw_semaphore dqoff_sem; /* serialize quota_off() and quota_on() on device and ops using quota_info struct, pointers from inode to dquots */ + struct semaphore dqonoff_sem; /* Serialize quotaon & quotaoff */ + struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */ struct file *files[MAXQUOTAS]; /* fp's to quotafiles */ struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 2.5.54 - quota support 2003-01-10 19:32 ` Jan Kara @ 2003-01-12 21:20 ` Lukas Hejtmanek 0 siblings, 0 replies; 11+ messages in thread From: Lukas Hejtmanek @ 2003-01-12 21:20 UTC (permalink / raw) To: Jan Kara; +Cc: Andrew Morton, linux-kernel On Fri, Jan 10, 2003 at 08:32:06PM +0100, Jan Kara wrote: > Ok. So I found the bug. Fix was a bit nontrivial (at one path we tried > to acquire one lock twice) but know it should work. The patch also > contain fix in ext2 - at some time ext2_setattr was written and call of > DQUOT_TRANSFER was missing so no quota was being transferred. > Please test whether the patch works for you. Good job. This patch works for me (tested with kernel 2.5.55, successfully patched with no errors). Thanks a lot. -- Lukáš Hejtmánek ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2003-01-12 21:11 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2003-01-06 0:38 2.5.54 - quota support Lukas Hejtmanek 2003-01-06 1:59 ` Andrew Morton 2003-01-06 10:36 ` Lukas Hejtmanek 2003-01-06 14:48 ` Jan Kara 2003-01-06 15:19 ` Lukas Hejtmanek 2003-01-07 16:40 ` Jan Kara 2003-01-08 1:21 ` Lukas Hejtmanek 2003-01-08 10:22 ` Miquel van Smoorenburg 2003-01-08 10:56 ` Jan Kara 2003-01-10 19:32 ` Jan Kara 2003-01-12 21:20 ` Lukas Hejtmanek
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox