]> err.no Git - linux-2.6/commitdiff
configfs: call drop_link() to cleanup after create_link() failure
authorLouis Rilling <Louis.Rilling@kerlabs.com>
Thu, 12 Jun 2008 15:26:47 +0000 (17:26 +0200)
committerMark Fasheh <mfasheh@suse.com>
Mon, 14 Jul 2008 20:57:16 +0000 (13:57 -0700)
When allow_link() succeeds but create_link() fails, the subsystem is not
informed of the failure.

This patch fixes this by calling drop_link() on create_link() failures.

Signed-off-by: Louis Rilling <Louis.Rilling@kerlabs.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
fs/configfs/symlink.c

index faeb4417a10df18ec440a2aea2bba0e801fec506..0004d18c40ac36d0cd730bd01d0d6ac070d9f12d 100644 (file)
@@ -140,8 +140,12 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna
                goto out_put;
 
        ret = type->ct_item_ops->allow_link(parent_item, target_item);
-       if (!ret)
+       if (!ret) {
                ret = create_link(parent_item, target_item, dentry);
+               if (ret && type->ct_item_ops->drop_link)
+                       type->ct_item_ops->drop_link(parent_item,
+                                                    target_item);
+       }
 
        config_item_put(target_item);
        path_put(&nd.path);