diff -NurpP --minimal linux-2.4.24-vs1.26-q0.12/fs/dquot.c linux-2.4.24-vs1.26-q0.13/fs/dquot.c --- linux-2.4.24-vs1.26-q0.12/fs/dquot.c 2004-01-25 17:18:25.000000000 +0100 +++ linux-2.4.24-vs1.26-q0.13/fs/dquot.c 2004-02-13 20:14:49.000000000 +0100 @@ -181,9 +181,9 @@ static struct list_head dqhash_hash[NR_D #define HASHSB(sb) ((unsigned int ) (sb)) -static inline int const dqh_hashfn(struct super_block *sb, unsigned int ctx) +static inline int const dqh_hashfn(struct super_block *sb, unsigned int xid) { - return (HASHSB(sb) ^ ctx) % NR_DQH_HASH; + return (HASHSB(sb) ^ xid) % NR_DQH_HASH; } static inline void insert_dqhash_hash(struct dqhash *hash) @@ -201,14 +201,14 @@ static inline void remove_dqhash_hash(st list_del_init(&hash->dqh_sblist); } -static inline struct dqhash *find_dqhash(unsigned int hashent, struct super_block *sb, unsigned int ctx) +static inline struct dqhash *find_dqhash(unsigned int hashent, struct super_block *sb, unsigned int xid) { struct list_head *head; struct dqhash *dqh; for (head = dqhash_hash[hashent].next; head != dqhash_hash+hashent; head = head->next) { dqh = list_entry(head, struct dqhash, dqh_list); - if (dqh->dqh_sb == sb && dqh->dqh_xid == ctx) + if (dqh->dqh_sb == sb && dqh->dqh_xid == xid) return dqh; } return NULL; @@ -431,7 +431,7 @@ static void invalidate_dquots(struct dqh static unsigned int dqhash_id = 0; -struct dqhash *new_dqhash(struct super_block *sb, unsigned int ctx) +struct dqhash *new_dqhash(struct super_block *sb, unsigned int xid) { struct dqhash *hash; int i; @@ -442,7 +442,7 @@ struct dqhash *new_dqhash(struct super_b memset(hash, 0, sizeof(struct dqhash)); hash->dqh_id = dqhash_id++; - hash->dqh_xid = ctx; + hash->dqh_xid = xid; atomic_set(&hash->dqh_count, 1); INIT_LIST_HEAD(&hash->dqh_list); INIT_LIST_HEAD(&hash->dqh_sblist); @@ -461,7 +461,8 @@ struct dqhash *new_dqhash(struct super_b init_rwsem(&hash->dqh_dlimit.dl_sem); lock_kernel(); - dprintk ("··· new_dqhash: #%d %p (sb=%p,ctx=%d)\n", hash->dqh_id, hash, hash->dqh_sb, hash->dqh_xid); + dprintk("··· new_dqhash: *%p[%d,#%d] sb:%p\n", + hash, hash->dqh_id, hash->dqh_xid, hash->dqh_sb); insert_dqhash_hash(hash); unlock_kernel(); return hash; @@ -471,7 +472,8 @@ void destroy_dqhash(struct dqhash *hash) { int cnt; - dprintk ("··· destroy_dqhash: #%d %p (sb=%p,ctx=%d)\n", hash->dqh_id, hash, hash->dqh_sb, hash->dqh_xid); + dprintk("··· destroy_dqhash: *%p[%d,#%d] sb:%p\n", + hash, hash->dqh_id, hash->dqh_xid, hash->dqh_sb); lock_kernel(); remove_dqhash_hash(hash); unlock_kernel(); @@ -481,12 +483,12 @@ void destroy_dqhash(struct dqhash *hash) kfree(hash); } -struct dqhash *get_dqhash(struct super_block *sb, unsigned int ctx) +struct dqhash *get_dqhash(struct super_block *sb, unsigned int xid) { - unsigned int hashent = dqh_hashfn(sb, ctx); + unsigned int hashent = dqh_hashfn(sb, xid); struct dqhash *hash; - if ((hash = find_dqhash(hashent, sb, ctx))) + if ((hash = find_dqhash(hashent, sb, xid))) return dqhget(hash); return NULL; } @@ -833,9 +835,10 @@ restart: struct vfsmount *mnt = mntget(filp->f_vfsmnt); struct dentry *dentry = dget(filp->f_dentry); - if (hash != inode->i_dqh) - printk("··· BAD INODE: add_dquot_ref(%p[%d], %d) %p[%d] »%*s«\n", - hash, hash->dqh_xid, type, inode, inode->i_xid, + /* an open file might have an xid but no hash yet */ + if (inode->i_dqh && hash != inode->i_dqh) + printk("··· BAD INODE: add_dquot_ref(%p[%d], %d) %p[%d](%p) »%*s«\n", + hash, hash->dqh_xid, type, inode, inode->i_xid, inode->i_dqh, filp->f_dentry->d_name.len, filp->f_dentry->d_name.name); file_list_unlock(); @@ -1101,11 +1104,20 @@ void dquot_initialize(struct inode *inod unsigned int id = 0; int cnt; + dprintk("··· dquot_initialize(A): \t" DFM_INO ": " DFM_DQH ", " DFM_DQH "\n", + DBD_INO(inode), DBD_DQH(inode->i_dqh), DBD_DQH(dqh)); if (IS_NOQUOTA(inode)) return; dqh = get_dqhash(inode->i_sb, current->vx_id); - dprintk("··· dquot_initialize: #%d %p\n", (dqh)?dqh->dqh_id:0, dqh); + dprintk("··· dquot_initialize: \t" DFM_INO ": " DFM_DQH ", " DFM_DQH "\n", + DBD_INO(inode), DBD_DQH(inode->i_dqh), DBD_DQH(dqh)); + if (dqh && !inode->i_dqh) { + dprintk("··· MISSING DQH: \t" DFM_INO " add " DFM_DQH "\n", + DBD_INO(inode), DBD_DQH(dqh)); + inode->i_dqh = dqh; + } + /* Build list of quotas to initialize... We can block here */ for (cnt = 0; cnt < MAXQUOTAS; cnt++) { dquot[cnt] = NODQUOT; @@ -1131,6 +1143,8 @@ void dquot_initialize(struct inode *inod for (cnt = 0; cnt < MAXQUOTAS; cnt++) { if (dquot[cnt] == NODQUOT || !dqh_has_quota_enabled(dqh, cnt) || inode->i_dquot[cnt] != NODQUOT) continue; + dprintk("··+ initialize: \t" DFM_INO ": " DFM_DQH " (%d)\n", + DBD_INO(inode), DBD_DQH(inode->i_dqh), cnt); inode->i_dquot[cnt] = dquot[cnt]; dquot[cnt] = NODQUOT; inode->i_flags |= S_QUOTA; @@ -1214,7 +1228,7 @@ int dquot_alloc_inode(const struct inode } /* NOBLOCK Start */ for (cnt = 0; cnt < MAXQUOTAS; cnt++) { - dquot[cnt] = dqduplicate(inode -> i_dquot[cnt]); + dquot[cnt] = dqduplicate(inode->i_dquot[cnt]); if (dquot[cnt] == NODQUOT) continue; if (check_idq(dquot[cnt], number, warntype+cnt) == NO_QUOTA) @@ -1285,7 +1299,7 @@ int __dquot_transfer(struct inode *inode qsize_t space; struct dquot *transfer_from[MAXQUOTAS]; struct dquot *transfer_to[MAXQUOTAS]; - struct dqhash *dqh = inode->i_dqh; /* use find_ctx_dqhash(inode->i_sb) */ + struct dqhash *dqh = inode->i_dqh; /* use find_xid_dqhash(inode->i_sb) */ uid_t new_uid = (iattr->ia_valid & ATTR_UID) ? iattr->ia_uid : inode->i_uid; gid_t new_gid = (iattr->ia_valid & ATTR_GID) ? iattr->ia_gid : inode->i_gid; int cnt, chuid, chgid; @@ -1313,11 +1327,15 @@ int __dquot_transfer(struct inode *inode if (!chuid) continue; transfer_to[cnt] = dqget(hash, new_uid, cnt); + dprintk("··+ usr transfer to: \t" DFM_DQH " (%d,%d) = $%p\n", + DBD_DQH(hash), new_uid, cnt, transfer_to[cnt]); break; case GRPQUOTA: if (!chgid) continue; transfer_to[cnt] = dqget(hash, new_gid, cnt); + dprintk("··+ grp transfer to: \t" DFM_DQH " (%d,%d) = $%p\n", + DBD_DQH(hash), new_uid, cnt, transfer_to[cnt]); break; } } @@ -1326,13 +1344,8 @@ int __dquot_transfer(struct inode *inode space = inode_get_bytes(inode); /* Build the transfer_from list and check the limits */ for (cnt = 0; cnt < MAXQUOTAS; cnt++) { - if (!dqh_has_quota_enabled(dqh, cnt)) - /* transfer from noquota domain ... */ - continue; - transfer_from[cnt] = dqduplicate(inode->i_dquot[cnt]); - if (transfer_from[cnt] == NODQUOT) - /* Can happen on quotafiles (quota isn't initialized on them)... */ - continue; + if (dqh_has_quota_enabled(dqh, cnt)) + transfer_from[cnt] = dqduplicate(inode->i_dquot[cnt]); if (transfer_to[cnt] == NODQUOT || !dqh_has_quota_enabled(hash, cnt)) /* transfer to noquota domain ... */ continue; @@ -1344,23 +1357,26 @@ int __dquot_transfer(struct inode *inode /* * Finally perform the needed transfer from transfer_from to transfer_to */ + inode->i_flags &= ~S_QUOTA; for (cnt = 0; cnt < MAXQUOTAS; cnt++) { if (transfer_from[cnt] == NODQUOT && transfer_to[cnt] == NODQUOT) /* nothing to transfer ... */ continue; if (transfer_from[cnt] != NODQUOT) { + dprintk("··+ decrement: $%p\n", transfer_from[cnt]); dquot_decr_inodes(transfer_from[cnt], 1); dquot_decr_space(transfer_from[cnt], space); } - if (transfer_to[cnt] != NODQUOT) { + dprintk("··+ increment: $%p\n", transfer_to[cnt]); dquot_incr_inodes(transfer_to[cnt], 1); dquot_incr_space(transfer_to[cnt], space); + inode->i_flags |= S_QUOTA; } - inode->i_dquot[cnt] = transfer_to[cnt]; } + /* NOBLOCK END. From now on we can block as we wish */ for (cnt = 0; cnt < MAXQUOTAS; cnt++) { @@ -1395,12 +1411,16 @@ int dqhash_transfer(struct inode *inode, struct iattr iattr; int ret = 0; + dprintk("··· dqhash_transfer(A): \t" DFM_INO ": " DFM_DQH " -> " DFM_DQH "\n", + DBD_INO(inode), DBD_DQH(inode->i_dqh), DBD_DQH(hash)); if (hash == inode->i_dqh) return ret; - if (!IS_QUOTAINIT(inode) || IS_NOQUOTA(inode)) + dprintk("··· dqhash_transfer(B): \t" DFM_INO ": " DFM_DQH " -> " DFM_DQH "\n", + DBD_INO(inode), DBD_DQH(inode->i_dqh), DBD_DQH(hash)); + if (IS_NOQUOTA(inode) || (!IS_QUOTAINIT(inode) && inode->i_dqh)) return ret; - dprintk("··· dqhash_transfer: %p [#%d], hash: %p->%p\n", - inode, inode->i_xid, inode->i_dqh, hash); + dprintk("··· dqhash_transfer: \t" DFM_INO ": " DFM_DQH " -> " DFM_DQH "\n", + DBD_INO(inode), DBD_DQH(inode->i_dqh), DBD_DQH(hash)); iattr.ia_valid = 0; ret = __dquot_transfer(inode, &iattr, hash); return ret; diff -NurpP --minimal linux-2.4.24-vs1.26-q0.12/fs/ext2/ialloc.c linux-2.4.24-vs1.26-q0.13/fs/ext2/ialloc.c --- linux-2.4.24-vs1.26-q0.12/fs/ext2/ialloc.c 2004-01-25 17:18:25.000000000 +0100 +++ linux-2.4.24-vs1.26-q0.13/fs/ext2/ialloc.c 2004-02-13 20:14:49.000000000 +0100 @@ -398,7 +398,7 @@ repeat: mark_inode_dirty(inode); unlock_super (sb); - if(DQUOT_ALLOC_INODE(inode)) { + if (DQUOT_ALLOC_INODE(inode)) { DQUOT_DROP(inode); inode->i_flags |= S_NOQUOTA; inode->i_nlink = 0; diff -NurpP --minimal linux-2.4.24-vs1.26-q0.12/fs/ext2/inode.c linux-2.4.24-vs1.26-q0.13/fs/ext2/inode.c --- linux-2.4.24-vs1.26-q0.12/fs/ext2/inode.c 2004-01-25 17:18:25.000000000 +0100 +++ linux-2.4.24-vs1.26-q0.13/fs/ext2/inode.c 2004-02-13 20:14:49.000000000 +0100 @@ -964,8 +964,8 @@ void ext2_read_inode (struct inode * ino inode->i_uid = INOXID_UID(uid, gid); inode->i_gid = INOXID_GID(uid, gid); if (inode->i_sb->s_flags & MS_TAGXID) { - int ctx = INOXID_XID(uid, gid, le16_to_cpu(raw_inode->i_raw_xid)); - __vx_dq_modify(inode, ctx); + int xid = INOXID_XID(uid, gid, le16_to_cpu(raw_inode->i_raw_xid)); + __vx_dq_modify(inode, xid); } inode->i_nlink = le16_to_cpu(raw_inode->i_links_count); diff -NurpP --minimal linux-2.4.24-vs1.26-q0.12/fs/ext3/ialloc.c linux-2.4.24-vs1.26-q0.13/fs/ext3/ialloc.c --- linux-2.4.24-vs1.26-q0.12/fs/ext3/ialloc.c 2004-01-25 17:18:25.000000000 +0100 +++ linux-2.4.24-vs1.26-q0.13/fs/ext3/ialloc.c 2004-02-13 20:14:49.000000000 +0100 @@ -513,7 +513,7 @@ repeat: if (err) goto fail; unlock_super (sb); - if(DQUOT_ALLOC_INODE(inode)) { + if (DQUOT_ALLOC_INODE(inode)) { DQUOT_DROP(inode); inode->i_flags |= S_NOQUOTA; inode->i_nlink = 0; diff -NurpP --minimal linux-2.4.24-vs1.26-q0.12/fs/ext3/inode.c linux-2.4.24-vs1.26-q0.13/fs/ext3/inode.c --- linux-2.4.24-vs1.26-q0.12/fs/ext3/inode.c 2004-01-25 17:18:25.000000000 +0100 +++ linux-2.4.24-vs1.26-q0.13/fs/ext3/inode.c 2004-02-13 20:14:49.000000000 +0100 @@ -2116,8 +2116,8 @@ void ext3_read_inode(struct inode * inod inode->i_uid = INOXID_UID(uid, gid); inode->i_gid = INOXID_GID(uid, gid); if (inode->i_sb->s_flags & MS_TAGXID) { - int ctx = INOXID_XID(uid, gid, le16_to_cpu(raw_inode->i_raw_xid)); - __vx_dq_modify(inode, ctx); + int xid = INOXID_XID(uid, gid, le16_to_cpu(raw_inode->i_raw_xid)); + __vx_dq_modify(inode, xid); } inode->i_nlink = le16_to_cpu(raw_inode->i_links_count); @@ -2227,7 +2227,6 @@ static int ext3_do_update_inode(handle_t if (err) goto out_brelse; } - uid = XIDINO_UID(inode->i_uid, inode->i_xid); gid = XIDINO_GID(inode->i_gid, inode->i_xid); diff -NurpP --minimal linux-2.4.24-vs1.26-q0.12/fs/ext3/ioctl.c linux-2.4.24-vs1.26-q0.13/fs/ext3/ioctl.c --- linux-2.4.24-vs1.26-q0.12/fs/ext3/ioctl.c 2004-01-25 17:18:21.000000000 +0100 +++ linux-2.4.24-vs1.26-q0.13/fs/ext3/ioctl.c 2004-02-13 20:14:49.000000000 +0100 @@ -153,7 +153,7 @@ flags_err: case EXT3_IOC_SETXID: { handle_t *handle; struct ext3_iloc iloc; - int ctx; + int xid; int err; /* fixme: if stealth, return -ENOTTY */ @@ -163,7 +163,7 @@ flags_err: return -EROFS; if (!(inode->i_sb->s_flags & MS_TAGXID)) return -ENOSYS; - if (get_user(ctx, (int *) arg)) + if (get_user(xid, (int *) arg)) return -EFAULT; handle = ext3_journal_start(inode, 1); @@ -173,7 +173,7 @@ flags_err: if (err) return err; - inode->i_xid = (ctx & 0xFFFF); + inode->i_xid = (xid & 0xFFFF); inode->i_ctime = CURRENT_TIME; err = ext3_mark_iloc_dirty(handle, inode, &iloc); diff -NurpP --minimal linux-2.4.24-vs1.26-q0.12/fs/ext3/super.c linux-2.4.24-vs1.26-q0.13/fs/ext3/super.c --- linux-2.4.24-vs1.26-q0.12/fs/ext3/super.c 2004-01-25 17:18:25.000000000 +0100 +++ linux-2.4.24-vs1.26-q0.13/fs/ext3/super.c 2004-02-13 20:14:49.000000000 +0100 @@ -524,6 +524,8 @@ static int parse_options (char * options } else if (!strcmp (this_char, "tagctx")) set_opt (*mount_options, TAG_XID); + else if (!strcmp (this_char, "tagxid")) + set_opt (*mount_options, TAG_XID); else if (!strcmp (this_char, "abort")) set_opt (*mount_options, ABORT); else if (!strcmp (this_char, "check")) { diff -NurpP --minimal linux-2.4.24-vs1.26-q0.12/fs/inode.c linux-2.4.24-vs1.26-q0.13/fs/inode.c --- linux-2.4.24-vs1.26-q0.12/fs/inode.c 2004-01-25 17:18:25.000000000 +0100 +++ linux-2.4.24-vs1.26-q0.13/fs/inode.c 2004-02-13 20:34:56.000000000 +0100 @@ -97,7 +97,8 @@ static struct inode *alloc_inode(struct inode->i_sb = sb; if (sb->s_flags & MS_TAGXID) inode->i_xid = current->vx_id; - inode->i_xid = 0; /* maybe ctx -1 would be better? */ + else + inode->i_xid = 0; /* maybe xid -1 would be better? */ inode->i_dqh = get_dqhash(sb, inode->i_xid); inode->i_dev = sb->s_dev; inode->i_blkbits = sb->s_blocksize_bits; diff -NurpP --minimal linux-2.4.24-vs1.26-q0.12/fs/ioctl.c linux-2.4.24-vs1.26-q0.13/fs/ioctl.c --- linux-2.4.24-vs1.26-q0.12/fs/ioctl.c 2004-01-25 17:18:25.000000000 +0100 +++ linux-2.4.24-vs1.26-q0.13/fs/ioctl.c 2004-02-13 20:14:49.000000000 +0100 @@ -127,7 +127,7 @@ asmlinkage long sys_ioctl(unsigned int f } case FIOC_SETXID: { struct inode *inode = filp->f_dentry->d_inode; - int ctx; + int xid; /* fixme: if stealth, return -ENOTTY */ error = -EPERM; @@ -140,10 +140,10 @@ asmlinkage long sys_ioctl(unsigned int f if (!(inode->i_sb->s_flags & MS_TAGXID)) break; error = -EFAULT; - if (get_user(ctx, (int *) arg)) + if (get_user(xid, (int *) arg)) break; error = 0; - inode->i_xid = (ctx & 0xFFFF); + inode->i_xid = (xid & 0xFFFF); inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); break; @@ -164,6 +164,7 @@ asmlinkage long sys_ioctl(unsigned int f } unlock_kernel(); fput(filp); + out: return error; } diff -NurpP --minimal linux-2.4.24-vs1.26-q0.12/fs/namei.c linux-2.4.24-vs1.26-q0.13/fs/namei.c --- linux-2.4.24-vs1.26-q0.12/fs/namei.c 2004-01-25 17:18:23.000000000 +0100 +++ linux-2.4.24-vs1.26-q0.13/fs/namei.c 2004-02-13 20:14:49.000000000 +0100 @@ -206,11 +206,11 @@ int vfs_permission(struct inode * inode, return -EACCES; } -static inline int ctx_permission(struct inode *inode, int ctx) +static inline int xid_permission(struct inode *inode) { - if ((ctx == 0) || (ctx == 1)) + if (inode->i_xid == 0) return 0; - if ((inode->i_xid == 0) || (inode->i_xid == ctx)) + if (vx_check(inode->i_xid, VX_ADMIN|VX_WATCH|VX_IDENT)) return 0; return -EACCES; } @@ -219,7 +219,7 @@ int permission(struct inode * inode,int { int retval = 0; - if ((retval = ctx_permission(inode, current->vx_id))) + if ((retval = xid_permission(inode))) return retval; if (inode->i_op && inode->i_op->permission) { lock_kernel(); @@ -1127,9 +1127,6 @@ ok: if (error) goto exit; - if ((flag & FMODE_WRITE) || (flag & O_TRUNC)) - vx_dq_cond_modify(inode, current->vx_id); - /* * FIFO's, sockets and device files are special: they don't * actually live on the filesystem itself, and as such you @@ -1187,6 +1184,9 @@ ok: if (flag & FMODE_WRITE) DQUOT_INIT(inode); + if ((flag & FMODE_WRITE) || (flag & O_TRUNC)) + vx_dq_cond_modify(inode, current->vx_id); + return 0; exit_dput: diff -NurpP --minimal linux-2.4.24-vs1.26-q0.12/fs/quota.c linux-2.4.24-vs1.26-q0.13/fs/quota.c --- linux-2.4.24-vs1.26-q0.12/fs/quota.c 2004-01-25 17:18:25.000000000 +0100 +++ linux-2.4.24-vs1.26-q0.13/fs/quota.c 2004-02-13 20:14:49.000000000 +0100 @@ -533,15 +533,15 @@ int remove_inode_dqhash_ref(struct inode return 0; } -int do_dqhashctl(struct super_block *sb, int ctx, uint cmds) +int do_dqhashctl(struct super_block *sb, int xid, uint cmds) { int ret = -EINVAL; - struct dqhash *dqh = get_dqhash(sb, ctx); + struct dqhash *dqh = get_dqhash(sb, xid); if (!dqhash_valid(dqh) && (cmds == Q_ADD_DQHASH)) { if (!(sb->s_flags & MS_TAGXID)) return -ENOSYS; - dqh = new_dqhash(sb, ctx); + dqh = new_dqhash(sb, xid); /* keep one refcount to hash */ return 0; } @@ -561,13 +561,12 @@ int do_dqhashctl(struct super_block *sb, int do_dqlimitctl(struct super_block *sb, uint cmds, qid_t id, caddr_t addr) { - int ctx = current->vx_id; struct dqhash *dqh; struct dqh_dlimit *dl; struct dli_limits dli; int ret = 0; - if ((ctx != 0) && (ctx != 1)) + if (!vx_check(0, VX_ADMIN|VX_WATCH)) /* stealth should return EINVAL? */ return -EPERM; @@ -658,17 +657,15 @@ asmlinkage long sys_quotactl(unsigned in goto out_sb; } else if (sb) { - int ctx = current->vx_id; - if ((cmds == Q_SET_DLIMIT) || (cmds == Q_GET_DLIMIT)) { ret = -EPERM; - if (ctx == 0) + if (vx_check(0, VX_ADMIN)) ret = do_dqlimitctl(sb, cmds, id, addr); goto out_sb; } if ((cmds == Q_ADD_DQHASH) || (cmds == Q_REM_DQHASH)) { ret = -EPERM; - if (ctx == 0) + if (vx_check(0, VX_ADMIN)) ret = do_dqhashctl(sb, id, cmds); goto out_sb; } diff -NurpP --minimal linux-2.4.24-vs1.26-q0.12/include/linux/fs.h linux-2.4.24-vs1.26-q0.13/include/linux/fs.h --- linux-2.4.24-vs1.26-q0.12/include/linux/fs.h 2004-02-07 19:51:02.000000000 +0100 +++ linux-2.4.24-vs1.26-q0.13/include/linux/fs.h 2004-02-13 20:35:03.000000000 +0100 @@ -456,6 +456,7 @@ struct inode { nlink_t i_nlink; uid_t i_uid; gid_t i_gid; + unsigned int i_xid; kdev_t i_rdev; loff_t i_size; time_t i_atime; @@ -484,7 +485,6 @@ struct inode { struct block_device *i_bdev; struct char_device *i_cdev; - unsigned int i_xid; /* LRU Context */ unsigned long i_dnotify_mask; /* Directory notify events */ struct dnotify_struct *i_dnotify; /* for directory notifications */ diff -NurpP --minimal linux-2.4.24-vs1.26-q0.12/include/linux/quota.h linux-2.4.24-vs1.26-q0.13/include/linux/quota.h --- linux-2.4.24-vs1.26-q0.12/include/linux/quota.h 2004-01-25 17:18:59.000000000 +0100 +++ linux-2.4.24-vs1.26-q0.13/include/linux/quota.h 2004-02-13 20:19:05.000000000 +0100 @@ -58,7 +58,7 @@ typedef __u64 qsize_t; /* Type #define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS) /* are NULL dqhash ptrs valid? */ -#define HANDLE_DQHASH_NULL +#define HANDLE_DQHASH_NULL #ifdef HANDLE_DQHASH_NULL #define dqhash_valid(hash) ((hash) != NULL) #else @@ -385,8 +385,8 @@ static inline void mark_dquot_dirty(stru #else /* CONFIG_QUOTA */ -#define new_dqhash(sb, ctx) (0) -#define get_dqhash(sb, ctx) (0) +#define new_dqhash(sb, xid) (0) +#define get_dqhash(sb, xid) (0) #define destroy_dqhash(hash) do { } while(0) #define dqhput(hash) do { } while(0) diff -NurpP --minimal linux-2.4.24-vs1.26-q0.12/include/linux/quotaops.h linux-2.4.24-vs1.26-q0.13/include/linux/quotaops.h --- linux-2.4.24-vs1.26-q0.12/include/linux/quotaops.h 2004-01-25 17:19:29.000000000 +0100 +++ linux-2.4.24-vs1.26-q0.13/include/linux/quotaops.h 2004-02-13 20:35:45.000000000 +0100 @@ -17,7 +17,21 @@ #include -#define dprintk(...) /* printk(__VA_ARGS__) */ +// #define DEBUG_MACROS +// #define DEBUG_HASHES +// #define DEBUG_DLIMIT +// #define DEBUG_QALLOC +// #define DEBUG_EXTERN + +#define DQH_ID(h) ((h)?((h)->dqh_id):0) +#define DQH_XID(h) ((h)?((h)->dqh_xid):0) + +#define DFM_INO "i%p[%5lu,#%3d]" +#define DBD_INO(i) (i), (i)->i_ino, (i)->i_xid + +#define DFM_DQH "*%p[%2d,#%3d]" +#define DBD_DQH(h) (h), DQH_ID(h), DQH_XID(h) + /* * declaration of quota_function calls in kernel. @@ -39,33 +53,41 @@ extern int dqhash_transfer(struct inode extern int dlimit_transfer(struct inode *inode, struct dqhash *hash); -static __inline__ void __vx_dq_modify(struct inode *inode, unsigned int ctx) +#ifdef DEBUG_HASHES +#define dprintk(...) printk(__VA_ARGS__) +#else +#define dprintk(...) +#endif + +static __inline__ void __vx_dq_modify(struct inode *inode, unsigned int xid) { - struct dqhash *dqh = get_dqhash(inode->i_sb, ctx); + struct dqhash *dqh = get_dqhash(inode->i_sb, xid); if (dqh != inode->i_dqh) { + dprintk("··· __vx_dq_modify: \t" DFM_INO ": " DFM_DQH " != " DFM_DQH "\n", + DBD_INO(inode), DBD_DQH(inode->i_dqh), DBD_DQH(dqh)); dqhash_transfer(inode, dqh); dlimit_transfer(inode, dqh); dqhput(inode->i_dqh); inode->i_dqh = dqh; } else dqhput(dqh); - inode->i_xid = ctx; + inode->i_xid = xid; } -static __inline__ void vx_dq_modify(struct inode *inode, unsigned int ctx) +static __inline__ void vx_dq_modify(struct inode *inode, unsigned int xid) { if (!(inode->i_sb->s_flags & MS_TAGXID)) return; - dprintk("··· vx_dq_modify: %p #%d -> #%d\n", inode, inode->i_xid, ctx); - __vx_dq_modify(inode, ctx); + dprintk("··· vx_dq_modify: \t" DFM_INO ": xid->#%d\n", DBD_INO(inode), xid); + __vx_dq_modify(inode, xid); mark_inode_dirty(inode); } -static __inline__ void vx_dq_cond_modify(struct inode *inode, unsigned int ctx) +static __inline__ void vx_dq_cond_modify(struct inode *inode, unsigned int xid) { - if (inode->i_xid != ctx) - vx_dq_modify(inode, ctx); + if (inode->i_xid != xid) + vx_dq_modify(inode, xid); } static __inline__ void vx_dq_unlink(struct inode *inode) @@ -78,7 +100,7 @@ static __inline__ void vx_dq_unlink(stru /* inode still referenced ... */ if (inode->i_xid == 0) return; - /* transfer back to ctx zero hash */ + /* transfer back to xid zero hash */ vx_dq_modify(inode, 0); } @@ -87,13 +109,22 @@ static __inline__ void CHECK_DQHASH(stru if (!dqhash_valid(inode->i_dqh)) return; if (inode->i_xid != inode->i_dqh->dqh_xid) { - printk("··· inode: %p [#%d] != dqh: %p [%d,#%d]\n", inode, inode->i_xid, - inode->i_dqh, inode->i_dqh->dqh_id, inode->i_dqh->dqh_xid); + printk("··· CHECK_DQHASH: " DFM_INO " xid != " DFM_DQH "\n", + DBD_INO(inode), DBD_DQH(inode->i_dqh)); dump_stack(); // BUG(); } } + +#undef dprintk +#ifdef DEBUG_DLIMIT +#define dprintk(...) printk(__VA_ARGS__) +#else +#define dprintk(...) +#endif + + #define NOILIMIT ((__u32)0) #define NOBLIMIT ((__u64)0) @@ -111,7 +142,7 @@ static __inline__ int dlimit_inodes_avai ret = (dl->dl_ilimit == NOILIMIT) || (dl->dl_ilimit >= (dl->dl_inodes + number)); if (!ret) - dprintk("··· dlimit_inodes_avail: %lld + %ld > %lld\n", + dprintk("··· dlimit_inodes_avail: %d + %ld > %d\n", dl->dl_inodes, number, dl->dl_ilimit); up_read(&dl->dl_sem); dqhput(dqh); @@ -192,6 +223,13 @@ static __inline__ void dlimit_decr_space extern struct dquot_operations dquot_operations; extern struct quotactl_ops vfs_quotactl_ops; +#undef dprintk +#ifdef DEBUG_MACROS +#define dprintk(...) printk(__VA_ARGS__) +#else +#define dprintk(...) +#endif + #define sb_dquot_ops (&dquot_operations) #define sb_quotactl_ops (&vfs_quotactl_ops) @@ -200,6 +238,8 @@ static __inline__ void DQUOT_INIT(struct if (!inode->i_sb) out_of_line_bug(); lock_kernel(); + dprintk("··· DQUOT_INIT: sb:%p " DFM_INO ": " DFM_DQH "\n", + inode->i_sb, DBD_INO(inode), DBD_DQH(inode->i_dqh)); CHECK_DQHASH(inode); if (!dqhash_valid(inode->i_dqh)) goto out; @@ -212,6 +252,8 @@ out: static __inline__ void DQUOT_DROP(struct inode *inode) { lock_kernel(); + dprintk("··· DQUOT_DROP: sb:%p " DFM_INO ": " DFM_DQH "\n", + inode->i_sb, DBD_INO(inode), DBD_DQH(inode->i_dqh)); if (IS_QUOTAINIT(inode)) { if (inode->i_dqh) inode->i_dqh->dqh_qop->drop(inode); /* Ops must be set when there's any quota... */ @@ -221,10 +263,19 @@ static __inline__ void DQUOT_DROP(struct unlock_kernel(); } +#undef dprintk +#ifdef DEBUG_QALLOC +#define dprintk(...) printk(__VA_ARGS__) +#else +#define dprintk(...) +#endif + static __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) { lock_kernel(); CHECK_DQHASH(inode); + dprintk("··· DQUOT_PREALLOC_SPACE_NODIRTY: " DFM_INO ": " DFM_DQH " (%d)\n", + DBD_INO(inode), DBD_DQH(inode->i_dqh), nr); if (dqh_any_quota_enabled(inode->i_dqh)) { /* Used space is updated in alloc_space() */ if (inode->i_dqh->dqh_qop->alloc_space(inode, nr, 1) == NO_QUOTA) { @@ -251,6 +302,8 @@ static __inline__ int DQUOT_ALLOC_SPACE_ { lock_kernel(); CHECK_DQHASH(inode); + dprintk("··· DQUOT_ALLOC_SPACE_NODIRTY: " DFM_INO ": " DFM_DQH " (%d)\n", + DBD_INO(inode), DBD_DQH(inode->i_dqh), nr); if (dqh_any_quota_enabled(inode->i_dqh)) { /* Used space is updated in alloc_space() */ if (inode->i_dqh->dqh_qop->alloc_space(inode, nr, 0) == NO_QUOTA) { @@ -277,6 +330,8 @@ static __inline__ int DQUOT_ALLOC_INODE( { lock_kernel(); CHECK_DQHASH(inode); + dprintk("··· DQUOT_ALLOC_INODE: " DFM_INO ": " DFM_DQH "\n", + DBD_INO(inode), DBD_DQH(inode->i_dqh)); if (dqh_any_quota_enabled(inode->i_dqh)) { DQUOT_INIT(inode); if (inode->i_dqh->dqh_qop->alloc_inode(inode, 1) == NO_QUOTA) { @@ -292,6 +347,8 @@ static __inline__ int DQUOT_ALLOC_INODE( static __inline__ void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) { lock_kernel(); + dprintk("··· DQUOT_FREE_SPACE_NODIRTY: " DFM_INO ": " DFM_DQH " (%d)\n", + DBD_INO(inode), DBD_DQH(inode->i_dqh), nr); if (dqh_any_quota_enabled(inode->i_dqh)) inode->i_dqh->dqh_qop->free_space(inode, nr); else @@ -309,6 +366,8 @@ static __inline__ void DQUOT_FREE_SPACE( static __inline__ void DQUOT_FREE_INODE(struct inode *inode) { lock_kernel(); + dprintk("··· DQUOT_FREE_INODE: " DFM_INO ": " DFM_DQH "\n", + DBD_INO(inode), DBD_DQH(inode->i_dqh)); dlimit_decr_inodes(inode->i_dqh, 1); if (dqh_any_quota_enabled(inode->i_dqh)) inode->i_dqh->dqh_qop->free_inode(inode, 1); @@ -318,6 +377,8 @@ static __inline__ void DQUOT_FREE_INODE( static __inline__ int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr) { lock_kernel(); + dprintk("··· DQUOT_TRANSFER: " DFM_INO ": " DFM_DQH "\n", + DBD_INO(inode), DBD_DQH(inode->i_dqh)); if (dqh_any_quota_enabled(inode->i_dqh) && !IS_NOQUOTA(inode)) { DQUOT_INIT(inode); if (inode->i_dqh->dqh_qop->transfer(inode, iattr) == NO_QUOTA) { @@ -337,12 +398,20 @@ static __inline__ int DQUOT_OFF(struct d int ret = -ENOSYS; lock_kernel(); + dprintk("··· DQUOT_OFF: " DFM_DQH "\n", DBD_DQH(hash)); if (hash->dqh_qcop && hash->dqh_qcop->quota_off) ret = hash->dqh_qcop->quota_off(hash, -1); unlock_kernel(); return ret; } +#undef dprintk +#ifdef DEBUG_EXTERN +#define dprintk(...) printk(__VA_ARGS__) +#else +#define dprintk(...) +#endif + #else /* @@ -360,12 +429,12 @@ static __inline__ int DQUOT_OFF(struct d #define DQUOT_OFF(hash) do { } while(0) #define DQUOT_TRANSFER(inode, iattr) (0) -#define new_dqhash(sb, ctx) (0) -#define get_dqhash(sb, ctx) (0) +#define new_dqhash(sb, xid) (0) +#define get_dqhash(sb, xid) (0) #define destroy_dqhash(hash) do { } while(0) -#define vx_dq_modify(inode, ctx) do { } while(0) -#define vx_dq_cond_modify(inode, ctx) do { } while(0) +#define vx_dq_modify(inode, xid) do { } while(0) +#define vx_dq_cond_modify(inode, xid) do { } while(0) #define vx_dq_unlink(inode) do { } while(0) #define CHECK_DQHASH(inode) do { } while(0) diff -NurpP --minimal linux-2.4.24-vs1.26-q0.12/include/linux/vxid.h linux-2.4.24-vs1.26-q0.13/include/linux/vxid.h --- linux-2.4.24-vs1.26-q0.12/include/linux/vxid.h 2004-01-25 17:18:59.000000000 +0100 +++ linux-2.4.24-vs1.26-q0.13/include/linux/vxid.h 2004-02-13 20:19:07.000000000 +0100 @@ -5,10 +5,10 @@ #define INOXID_UID(uid, gid) (uid) #define INOXID_GID(uid, gid) (gid) -#define INOXID_XID(uid, gid, ctx) (0) +#define INOXID_XID(uid, gid, xid) (0) -#define XIDINO_UID(uid, ctx) (uid) -#define XIDINO_GID(gid, ctx) (gid) +#define XIDINO_UID(uid, xid) (uid) +#define XIDINO_GID(gid, xid) (gid) #define MAX_UID 0xFFFFFFFF #define MAX_GID 0xFFFFFFFF @@ -19,10 +19,10 @@ #define INOXID_UID(uid, gid) (uid) #define INOXID_GID(uid, gid) ((gid) & 0xFFFF) -#define INOXID_XID(uid, gid, ctx) (((gid) >> 16) & 0xFFFF) +#define INOXID_XID(uid, gid, xid) (((gid) >> 16) & 0xFFFF) -#define XIDINO_UID(uid, ctx) (uid) -#define XIDINO_GID(gid, ctx) (((gid) & 0xFFFF) | ((ctx) << 16)) +#define XIDINO_UID(uid, xid) (uid) +#define XIDINO_GID(gid, xid) (((gid) & 0xFFFF) | ((xid) << 16)) #define MAX_UID 0xFFFFFFFF #define MAX_GID 0x0000FFFF @@ -33,10 +33,10 @@ #define INOXID_UID(uid, gid) ((uid) & 0xFFFFFF) #define INOXID_GID(uid, gid) ((gid) & 0xFFFFFF) -#define INOXID_XID(uid, gid, ctx) ((((uid) >> 16) & 0xFF00) | (((gid) >> 24) & 0xFF)) +#define INOXID_XID(uid, gid, xid) ((((uid) >> 16) & 0xFF00) | (((gid) >> 24) & 0xFF)) -#define XIDINO_UID(uid, ctx) (((uid) & 0xFFFFFF) | (((ctx) & 0xFF00) << 16)) -#define XIDINO_GID(gid, ctx) (((gid) & 0xFFFFFF) | (((ctx) & 0x00FF) << 24)) +#define XIDINO_UID(uid, xid) (((uid) & 0xFFFFFF) | (((xid) & 0xFF00) << 16)) +#define XIDINO_GID(gid, xid) (((gid) & 0xFFFFFF) | (((xid) & 0x00FF) << 24)) #define MAX_UID 0x00FFFFFF #define MAX_GID 0x00FFFFFF @@ -47,10 +47,10 @@ #define INOXID_UID(uid, gid) (uid) #define INOXID_GID(uid, gid) (gid) -#define INOXID_XID(uid, gid, ctx) (ctx) +#define INOXID_XID(uid, gid, xid) (xid) -#define XIDINO_UID(uid, ctx) (uid) -#define XIDINO_GID(gid, ctx) (gid) +#define XIDINO_UID(uid, xid) (uid) +#define XIDINO_GID(gid, xid) (gid) #define MAX_UID 0xFFFFFFFF #define MAX_GID 0xFFFFFFFF