]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/btrfs/send.c
Merge branch 'dev/gfp-flags' into for-next-4.6-20160203
[karo-tx-linux.git] / fs / btrfs / send.c
index 1affded5fba07b66f28d8c548136625947cba47d..d2e29925f1da3bc6f3d4ce3846733cd058a301bf 100644 (file)
@@ -1469,7 +1469,21 @@ static int read_symlink(struct btrfs_root *root,
        ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
        if (ret < 0)
                goto out;
-       BUG_ON(ret);
+       if (ret) {
+               /*
+                * An empty symlink inode. Can happen in rare error paths when
+                * creating a symlink (transaction committed before the inode
+                * eviction handler removed the symlink inode items and a crash
+                * happened in between or the subvol was snapshoted in between).
+                * Print an informative message to dmesg/syslog so that the user
+                * can delete the symlink.
+                */
+               btrfs_err(root->fs_info,
+                         "Found empty symlink inode %llu at root %llu",
+                         ino, root->root_key.objectid);
+               ret = -EIO;
+               goto out;
+       }
 
        ei = btrfs_item_ptr(path->nodes[0], path->slots[0],
                        struct btrfs_file_extent_item);