[PATCH] Don't allow xtLookup to run against directory with inline data (3 of 3)
[email protected] (Dave Kleikamp) Wed, 23 Mar 2005 16:59:45 -0600 (CST)
| Newsgroups | gmane.comp.file-systems.jfs.patches |
|---|---|
| Message-ID | <[email protected]> |
# This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/03/23 16:43:50-06:00 [email protected] # JFS: Don't allow xtLookup to run against directory with inline data # # Signed-off-by: Dave Kleikamp <[email protected]> # diff -Nru a/fs/jfs/inode.c b/fs/jfs/inode.c --- a/fs/jfs/inode.c 2005-03-23 16:57:13 -06:00 +++ b/fs/jfs/inode.c 2005-03-23 16:57:13 -06:00 @@ -176,7 +176,6 @@ struct buffer_head *bh_result, int create) { s64 lblock64 = lblock; - int no_size_check = 0; int rc = 0; int take_locks; xad_t xad; @@ -201,15 +200,13 @@ } /* - * A directory's "data" is the inode index table, but i_size is the - * size of the d-tree, so don't check the offset against i_size + * Don't try to do xtLookup when there is no xtree */ - if (S_ISDIR(ip->i_mode)) - no_size_check = 1; + if (S_ISDIR(ip->i_mode) && jfs_dirtable_inline(ip)) + goto unlock; - if ((no_size_check || - ((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size)) && - (xtLookup(ip, lblock64, max_blocks, &xflag, &xaddr, &xlen, no_size_check) + if (((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size) && + (xtLookup(ip, lblock64, max_blocks, &xflag, &xaddr, &xlen, 0) == 0) && xlen) { if (xflag & XAD_NOTRECORDED) { if (!create) diff -Nru a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c --- a/fs/jfs/jfs_dtree.c 2005-03-23 16:57:13 -06:00 +++ b/fs/jfs/jfs_dtree.c 2005-03-23 16:57:13 -06:00 @@ -268,7 +268,7 @@ return NULL; } - if (jfs_ip->next_index <= (MAX_INLINE_DIRTABLE_ENTRY + 1)) { + if (jfs_dirtable_inline(ip)) { /* * Inline directory table */ @@ -2828,7 +2828,7 @@ * the old directory table. */ if (DO_INDEX(ip)) { - if (jfs_ip->next_index > (MAX_INLINE_DIRTABLE_ENTRY + 1)) { + if (!jfs_dirtable_inline(ip)) { struct tblock *tblk = tid_to_tblock(tid); /* * We're playing games with the tid's xflag. If diff -Nru a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h --- a/fs/jfs/jfs_incore.h 2005-03-23 16:57:13 -06:00 +++ b/fs/jfs/jfs_incore.h 2005-03-23 16:57:13 -06:00 @@ -178,6 +178,11 @@ return list_entry(inode, struct jfs_inode_info, vfs_inode); } +static inline int jfs_dirtable_inline(struct inode *inode) +{ + return (JFS_IP(inode)->next_index <= (MAX_INLINE_DIRTABLE_ENTRY + 1)); +} + static inline struct jfs_sb_info *JFS_SBI(struct super_block *sb) { return sb->s_fs_info; @@ -189,5 +194,4 @@ return 0; return 1; } - #endif /* _H_JFS_INCORE */ diff -Nru a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c --- a/fs/jfs/jfs_txnmgr.c 2005-03-23 16:57:13 -06:00 +++ b/fs/jfs/jfs_txnmgr.c 2005-03-23 16:57:13 -06:00 @@ -1567,7 +1567,7 @@ /* log after-image for logredo(): */ lrd->type = cpu_to_le16(LOG_REDOPAGE); - if (JFS_IP(tlck->ip)->next_index < MAX_INLINE_DIRTABLE_ENTRY) { + if (jfs_dirtable_inline(tlck->ip)) { /* * The table has been truncated, we've must have deleted * the last entry, so don't bother logging this ------------------------------------------------------- This SF.net email is sponsored by Microsoft Mobile & Embedded DevCon 2005 Attend MEDC 2005 May 9-12 in Vegas. Learn more about the latest Windows Embedded(r) & Windows Mobile(tm) platforms, applications & content. Register by 3/29 & save $300 http://ads.osdn.com/?ad_id=6883&alloc_id=15149&op=click