Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gfs2: inode directory consistency checks

In gfs2_dinode_in(), only allow directories to have the GFS2_DIF_EXHASH
flag set. This will prevent other parts of the code from treating
regular inodes as directories based on the presence of that flag.

In sweep_bh_for_rgrps() and __gfs2_free_blocks(), check if the
GFS2_DIF_EXHASH flag is set instead of checking if i_depth is non-zero.
This matches what the directory code does. (The i_depth checks were
introduced in commit 6d3117b412951 ("GFS2: Wipe directory hash table
metadata when deallocating a directory").)

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>

+7 -2
+1 -1
fs/gfs2/bmap.c
··· 1539 1539 revokes = jblocks_rqsted; 1540 1540 if (meta) 1541 1541 revokes += end - start; 1542 - else if (ip->i_depth) 1542 + else if (ip->i_diskflags & GFS2_DIF_EXHASH) 1543 1543 revokes += sdp->sd_inptrs; 1544 1544 ret = gfs2_trans_begin(sdp, jblocks_rqsted, revokes); 1545 1545 if (ret)
+5
fs/gfs2/glops.c
··· 457 457 ip->i_depth = (u8)depth; 458 458 ip->i_entries = be32_to_cpu(str->di_entries); 459 459 460 + if (!S_ISDIR(inode->i_mode) && (ip->i_diskflags & GFS2_DIF_EXHASH)) { 461 + gfs2_consist_inode(ip); 462 + return -EIO; 463 + } 464 + 460 465 if (gfs2_is_stuffed(ip) && inode->i_size > gfs2_max_stuffed_size(ip)) { 461 466 gfs2_consist_inode(ip); 462 467 return -EIO;
+1 -1
fs/gfs2/rgrp.c
··· 2529 2529 rgrp_unlock_local(rgd); 2530 2530 2531 2531 /* Directories keep their data in the metadata address space */ 2532 - if (meta || ip->i_depth || gfs2_is_jdata(ip)) 2532 + if (meta || (ip->i_diskflags & GFS2_DIF_EXHASH) || gfs2_is_jdata(ip)) 2533 2533 gfs2_journal_wipe(ip, bstart, blen); 2534 2534 } 2535 2535