aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-10-30 03:26:04 -0400
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-10-30 03:26:04 -0400
commit9ed0451ee0a13469f7b38e4ced8974036f6d114f (patch)
treebb9c5622198296933512dea3cefacfc17756eb1c /fs/xfs/xfs_inode.c
parent087e3b0460c367d0f4a5b71d7b013968ae23b588 (diff)
[XFS] free partially initialized inodes using destroy_inode
To make sure we free the security data inodes need to be freed using the proper VFS helper (which we also need to export for this). We mark these inodes bad so we can skip the flush path for them. SGI-PV: 987246 SGI-Modid: xfs-linux-melb:xfs-kern:32398a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com> Signed-off-by: David Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 35e419191abf..cd522827f99e 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -898,18 +898,14 @@ xfs_iread(
898 * know that this is a new incore inode. 898 * know that this is a new incore inode.
899 */ 899 */
900 error = xfs_itobp(mp, tp, ip, &dip, &bp, bno, imap_flags, XFS_BUF_LOCK); 900 error = xfs_itobp(mp, tp, ip, &dip, &bp, bno, imap_flags, XFS_BUF_LOCK);
901 if (error) { 901 if (error)
902 xfs_idestroy(ip); 902 goto out_destroy_inode;
903 return error;
904 }
905 903
906 /* 904 /*
907 * If we got something that isn't an inode it means someone 905 * If we got something that isn't an inode it means someone
908 * (nfs or dmi) has a stale handle. 906 * (nfs or dmi) has a stale handle.
909 */ 907 */
910 if (be16_to_cpu(dip->di_core.di_magic) != XFS_DINODE_MAGIC) { 908 if (be16_to_cpu(dip->di_core.di_magic) != XFS_DINODE_MAGIC) {
911 xfs_idestroy(ip);
912 xfs_trans_brelse(tp, bp);
913#ifdef DEBUG 909#ifdef DEBUG
914 xfs_fs_cmn_err(CE_ALERT, mp, "xfs_iread: " 910 xfs_fs_cmn_err(CE_ALERT, mp, "xfs_iread: "
915 "dip->di_core.di_magic (0x%x) != " 911 "dip->di_core.di_magic (0x%x) != "
@@ -917,7 +913,8 @@ xfs_iread(
917 be16_to_cpu(dip->di_core.di_magic), 913 be16_to_cpu(dip->di_core.di_magic),
918 XFS_DINODE_MAGIC); 914 XFS_DINODE_MAGIC);
919#endif /* DEBUG */ 915#endif /* DEBUG */
920 return XFS_ERROR(EINVAL); 916 error = XFS_ERROR(EINVAL);
917 goto out_brelse;
921 } 918 }
922 919
923 /* 920 /*
@@ -931,14 +928,12 @@ xfs_iread(
931 xfs_dinode_from_disk(&ip->i_d, &dip->di_core); 928 xfs_dinode_from_disk(&ip->i_d, &dip->di_core);
932 error = xfs_iformat(ip, dip); 929 error = xfs_iformat(ip, dip);
933 if (error) { 930 if (error) {
934 xfs_idestroy(ip);
935 xfs_trans_brelse(tp, bp);
936#ifdef DEBUG 931#ifdef DEBUG
937 xfs_fs_cmn_err(CE_ALERT, mp, "xfs_iread: " 932 xfs_fs_cmn_err(CE_ALERT, mp, "xfs_iread: "
938 "xfs_iformat() returned error %d", 933 "xfs_iformat() returned error %d",
939 error); 934 error);
940#endif /* DEBUG */ 935#endif /* DEBUG */
941 return error; 936 goto out_brelse;
942 } 937 }
943 } else { 938 } else {
944 ip->i_d.di_magic = be16_to_cpu(dip->di_core.di_magic); 939 ip->i_d.di_magic = be16_to_cpu(dip->di_core.di_magic);
@@ -1004,6 +999,12 @@ xfs_iread(
1004 xfs_trans_brelse(tp, bp); 999 xfs_trans_brelse(tp, bp);
1005 *ipp = ip; 1000 *ipp = ip;
1006 return 0; 1001 return 0;
1002
1003 out_brelse:
1004 xfs_trans_brelse(tp, bp);
1005 out_destroy_inode:
1006 xfs_destroy_inode(ip);
1007 return error;
1007} 1008}
1008 1009
1009/* 1010/*