xfs
[Top] [All Lists]

TAKE 821412 - group quota inode create with directory ISGID set

To: nathans@xxxxxxxxxxxxxxxxxxxx
Subject: TAKE 821412 - group quota inode create with directory ISGID set
From: pv@xxxxxxxxxxxxxxxxxxxxxx (nathans@xxxxxxxxxxxx)
Date: Mon, 16 Apr 2001 18:25:04 -0700 (PDT)
Cc: linux-xfs@xxxxxxxxxxx
Reply-to: sgi.bugs.xfs@xxxxxxxxxxxxxxxxx
Sender: owner-linux-xfs@xxxxxxxxxxx
 Submitter : nathans                  *Status : closed                      
 Assigned Engineer : nathans          *Fixed By : nathans                   
*Fixed By Domain : engr               *Closed Date : 04/16/01               
 Priority : 2                         *Modified Date : 04/16/01             
*Modified User : nathans              *Modified User Domain : engr          
*Fix Description :
From: nathan scott <nathans@xxxxxxxxxxxxxxxxxxxxxxx> (TAKE)
Date: Apr 16 2001 06:25:03PM
[pvnews version: 1.71]
----------------------------

merge fix back to 1.0 tree.


Date:  Mon Apr 16 18:19:10 PDT 2001
Workarea:  snort.melbourne.sgi.com:/diskb/build4/nathans/xfs1.0
Author:  nathans
Merged by:  nathans
Merged mods:  2.4.x-xfs:slinx:92673a

The following file(s) were checked into:
  bonnie.engr.sgi.com:/isms/slinx/2.4.x-xfs-r1.0


Modid:  2.4.x-xfs-r1.0:slinx:92673a
linux/fs/xfs/xfs_vnodeops.c - 1.498
        - Merge of 2.4.x-xfs:slinx:92673a by nathans.
          fix group inheritance and quota interaction (bug #821412).

linux/fs/xfs/xfs_dquot.c - 1.56
        - Merge of 2.4.x-xfs:slinx:92673a by nathans.
          fix an incorrect comment.

linux/fs/xfs/xfs_qm.c - 1.64
        - Merge of 2.4.x-xfs:slinx:92673a by nathans.
          fix group inheritance and quota interaction (bug #821412).

linux/fs/xfs/xfs_inode.c - 1.316
linux/fs/xfs/xfs_inode.h - 1.146
        - Merge of 2.4.x-xfs:slinx:92673a by nathans.
          abstract group inheritance test into a sharable macro.

linux/fs/xfs/xfs_quota.h - 1.24
        - Merge of 2.4.x-xfs:slinx:92673a by nathans.
          fix group inheritance and quota interaction (bug #821412).
Description :
[ I have a fix for this, just want to record the issue for posterity].
With debug enabled, its possible to trip the group quota code up in this
assert:

XFS assertion failed: ip->i_d.di_gid == INT_GET(gdqp->q_core.d_id, 
ARCH_CONVERT), file: xfs_qm.c, line: 2815
kernel BUG at debug.c:48!

Entering kdb (current=0xc51fa000, pid 1245) Oops: invalid operand
due to oops @ 0xc020d9ed
eax = 0x0000001a ebx = 0xc5f2a060 ecx = 0x00000001 edx = 0x00000001 
esi = 0xc5f2a1c4 edi = 0xc50e84a0 esp = 0xc51fbd34 eip = 0xc020d9ed 
ebp = 0xc51fbd40 xss = 0x00000018 xcs = 0x00000010 eflags = 0x00010282 
xds = 0x00000018 xes = 0x00000018 origeax = 0xffffffff &regs = 0xc51fbd00
kdb> bt
    EBP       EIP         Function(args)
0xc51fbd40 0xc020d9ed assfail+0x2d (0xc02d37a0, 0xc02d2bf8, 0xaff)
                               kernel .text 0xc0100000 0xc020d9c0 0xc020d9f4
0xc51fbd60 0xc0193874 xfs_qm_vop_dqattach_and_dqmod_newinode+0x15c (0xc5cba920, 
0xc50e84a0, 0xc5f2a060, 0xc5f2a1c4)
                               kernel .text 0xc0100000 0xc0193718 0xc0193894
0xc51fbe28 0xc01fbb17 xfs_create+0x61b (0xc5303d78, 0xc51b31c0, 0xc51fbe74, 
0x0, 0x0)
                               kernel .text 0xc0100000 0xc01fb4fc 0xc01fc284
0xc51fbee4 0xc0205af4 linvfs_common_cr+0xdc (0xc52e7820, 0xc51b3160, 0x8180, 
0x1, 0x0)
                               kernel .text 0xc0100000 0xc0205a18 0xc0205bdc
0xc51fbf00 0xc0205bf4 linvfs_create+0x18 (0xc52e7820, 0xc51b3160, 0x8180, 
0xc51b3160, 0xc53375a0)
                               kernel .text 0xc0100000 0xc0205bdc 0xc0205bf8
0xc51fbf24 0xc0136840 vfs_create+0xb0 (0xc52e7820, 0xc51b3160, 0x180)
                               kernel .text 0xc0100000 0xc0136790 0xc0136874
0xc51fbf58 0xc01369bc open_namei+0x148 (0xc5870000, 0xc2, 0x180, 0xc51fbf7c)
                               kernel .text 0xc0100000 0xc0136874 0xc0136e30
0xc51fbf98 0xc012b1d2 filp_open+0x3a (0xc5870000, 0xc1, 0x180)
                               kernel .text 0xc0100000 0xc012b198 0xc012b1f4
0xc51fbfbc 0xc012b4de sys_open+0x3e (0x806f520, 0xc1, 0x180, 0x1, 0x80a4594)
                               kernel .text 0xc0100000 0xc012b4a0 0xc012b560
           0xc0106eb3 system_call+0x33
                               kernel .text 0xc0100000 0xc0106e80 0xc0106eb8


The problem is a side-effect of this code in xfs_ialloc(), which can
change the inode gid in a way the quota subsystem doesn't expect it to.
This (obviously) wasn't something that affected projects..

        /*
         * For multiple groups support: if ISGID bit is set in the parent
         * directory, group of new file is set to that of the parent, and
         * new subdirectory gets ISGID bit from parent.
         */
        if (pip != NULL &&
            ((vp->v_vfsp->vfs_flag & VFS_GRPID) ||
             (pip->i_d.di_mode & ISGID))) {
                ip->i_d.di_gid = pip->i_d.di_gid;
                if ((pip->i_d.di_mode & ISGID) && (mode & IFMT) == IFDIR) {
                        ip->i_d.di_mode |= ISGID;
                }
        }

 
On creation of a new inode the higher-up quota code (see xfs_create,
xfs_mkdir, xfs_symlink) assumes that the id will not change underneath
it, but it clearly can now that we do group quota instead of project
quota.

Without debug enabled, such a create will simply be accounted to the
wrong gid.

<Prev in Thread] Current Thread [Next in Thread>
  • TAKE 821412 - group quota inode create with directory ISGID set, nathans@xxxxxxxxxxxx <=