commit 7e7e999d65f1559485bacd9f9cf82fe170002a9e
Author: Rachita Kothiyal <[EMAIL PROTECTED]>
Date:   Sun May 18 04:04:29 2008 -0400

    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 <[EMAIL PROTECTED]>

diff --git a/fs/unionfs/export.c b/fs/unionfs/export.c
index 7ba349b..8f88e19 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) {
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to