]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/exofs/inode.c
exofs: Error recovery if object is missing from storage
[net-next-2.6.git] / fs / exofs / inode.c
index 6ca0b0117f04c372b90a34e8812347adb6e6f13b..5514f3c2c2f4640037012b6e7ac5a2525f39c94a 100644 (file)
@@ -903,8 +903,18 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
        ios->in_attr_len = ARRAY_SIZE(attrs);
 
        ret = exofs_sbi_read(ios);
-       if (ret)
+       if (unlikely(ret)) {
+               EXOFS_ERR("object(0x%llx) corrupted, return empty file=>%d\n",
+                         _LLU(ios->obj.id), ret);
+               memset(inode, 0, sizeof(*inode));
+               inode->i_mode = 0040000 | (0777 & ~022);
+               /* If object is lost on target we might as well enable it's
+                * delete.
+                */
+               if ((ret == -ENOENT) || (ret == -EINVAL))
+                       ret = 0;
                goto out;
+       }
 
        ret = extract_attr_from_ios(ios, &attrs[0]);
        if (ret) {