From 7e7e999d65f1559485bacd9f9cf82fe170002a9e Mon Sep 17 00:00:00 2001 From: Rachita Kothiyal Date: Sun, 18 May 2008 04:04:29 -0400 Subject: [PATCH] Unionfs ODF: Exports: Handle inodes which have been deleted. Lookup the inode in the ODF, which provides a persistent store of inode attributes, to identify bad inodes (ie inodes which have been deleted) Signed-off-by: Rachita Kothiyal --- fs/unionfs/export.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/fs/unionfs/export.c b/fs/unionfs/export.c index 7ba349b17c..8f88e19f6d 100644 --- a/fs/unionfs/export.c +++ b/fs/unionfs/export.c @@ -226,30 +226,35 @@ static struct dentry *unionfs_export_iget(struct super_block *sb, unsigned long ino, __u32 generation, __u32 mode) { - struct inode *inode; + struct inode *inode, *odf_inode; struct dentry *result; int err = 0; if (ino == 0 || mode == 0) return ERR_PTR(-ESTALE); + /* + * Consult the ODF to check on the inode's health. Specially + * useful when the client requests an inode which was deleted. + * Since the ODF is our persistent store, atleast for attributes, + * we refer to it. + */ + odf_inode = iget(UNIONFS_SB(sb)->odf.path.mnt->mnt_sb, ino); + if (odf_inode == NULL) { + return ERR_PTR(-ENOMEM); + } else { + if (is_bad_inode(odf_inode) || (generation && + odf_inode->i_generation != generation)) { + iput(odf_inode); + return ERR_PTR(-ESTALE); + } + } + iput(odf_inode); + inode = iget(sb, ino); if (inode == NULL) return ERR_PTR(-ENOMEM); - /* A generation of 0 means "accept any" */ - if (is_bad_inode(inode) || (generation - && inode->i_generation != generation)) { - /* we didn't find the right inode.. */ - printk(KERN_ERR "fh_verify: Inode %lu, Bad count: %d %d " - "or version %u %u\n", inode->i_ino, inode->i_nlink, - atomic_read(&inode->i_count), inode->i_generation, - generation); - - iput(inode); - return ERR_PTR(-ESTALE); - } - /* Now find a dentry. If possible, get a well-connected one */ result = d_alloc_anon(inode); if (!result) { -- 2.43.0