2008-06-12 15:31:32

by Louis Rilling

[permalink] [raw]
Subject: [RFC][PATCH 2/3] configfs: call drop_link() to cleanup after create_link() failure

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 <[email protected]>
---
fs/configfs/symlink.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Index: b/fs/configfs/symlink.c
===================================================================
--- a/fs/configfs/symlink.c 2008-06-12 17:13:27.000000000 +0200
+++ b/fs/configfs/symlink.c 2008-06-12 17:13:38.000000000 +0200
@@ -137,8 +137,12 @@ int configfs_symlink(struct inode *dir,
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);

--
Dr Louis Rilling Kerlabs
Skype: louis.rilling Batiment Germanium
Phone: (+33|0) 6 80 89 08 23 80 avenue des Buttes de Coesmes
http://www.kerlabs.com/ 35700 Rennes


2008-06-12 18:46:04

by Joel Becker

[permalink] [raw]
Subject: Re: [RFC][PATCH 2/3] configfs: call drop_link() to cleanup after create_link() failure

On Thu, Jun 12, 2008 at 05:26:47PM +0200, Louis Rilling wrote:
> 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 <[email protected]>

This looks good.

Joel

--

"Friends may come and go, but enemies accumulate."
- Thomas Jones

Joel Becker
Principal Software Developer
Oracle
E-mail: [email protected]
Phone: (650) 506-8127