* [PATCH 09/10] btrfs: fix some problem in btrfs_link()
@ 2010-05-20 7:24 Miao Xie
0 siblings, 0 replies; only message in thread
From: Miao Xie @ 2010-05-20 7:24 UTC (permalink / raw)
To: Chris Mason, Linux Btrfs
- add check for btrfs_start_transaction()'s return value
- fix no drop the nlink of the inode if btrfs_set_inode_index() fails,.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
fs/btrfs/inode.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1cef510..1392a09 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4418,15 +4418,18 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
if (err)
return err;
- btrfs_inc_nlink(inode);
+ trans = btrfs_start_transaction(root, 1);
+ if (!trans) {
+ err = -ENOMEM;
+ goto fail;
+ }
err = btrfs_set_inode_index(dir, &index);
if (err)
goto fail;
- trans = btrfs_start_transaction(root, 1);
-
btrfs_set_trans_block_group(trans, dir);
+ btrfs_inc_nlink(inode);
atomic_inc(&inode->i_count);
err = btrfs_add_nondir(trans, dentry, inode, 1, index);
--
1.6.5.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-05-20 7:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-20 7:24 [PATCH 09/10] btrfs: fix some problem in btrfs_link() Miao Xie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).