diff options
author | Yan <yanzheng@21cn.com> | 2008-01-17 11:59:51 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:59 -0400 |
commit | fb4bc1e0565a842d704846005ac0ec739e608ede (patch) | |
tree | d4670954777c4e74ae2385521eeda3965acf4d5b /fs/btrfs/inode.c | |
parent | caaca38b8fdcf63a17647fddae2195b189e19e37 (diff) |
Btrfs: Fix compile on 2.6.22 kernel
This patch fixes compile error on kernel-2.6.22
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c1ac0bcbb462..51fc06dc4a5d 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -2322,15 +2322,16 @@ static int create_snapshot(struct btrfs_root *root, char *name, int namelen) | |||
2322 | ret = -ENOMEM; | 2322 | ret = -ENOMEM; |
2323 | goto fail_unlock; | 2323 | goto fail_unlock; |
2324 | } | 2324 | } |
2325 | pending_snapshot->name = kstrndup(name, namelen, GFP_NOFS); | 2325 | pending_snapshot->name = kmalloc(namelen + 1, GFP_NOFS); |
2326 | if (!pending_snapshot->name) { | 2326 | if (!pending_snapshot->name) { |
2327 | ret = -ENOMEM; | 2327 | ret = -ENOMEM; |
2328 | kfree(pending_snapshot); | 2328 | kfree(pending_snapshot); |
2329 | goto fail_unlock; | 2329 | goto fail_unlock; |
2330 | } | 2330 | } |
2331 | memcpy(pending_snapshot->name, name, namelen); | ||
2332 | pending_snapshot->name[namelen] = '\0'; | ||
2331 | trans = btrfs_start_transaction(root, 1); | 2333 | trans = btrfs_start_transaction(root, 1); |
2332 | BUG_ON(!trans); | 2334 | BUG_ON(!trans); |
2333 | |||
2334 | pending_snapshot->root = root; | 2335 | pending_snapshot->root = root; |
2335 | list_add(&pending_snapshot->list, | 2336 | list_add(&pending_snapshot->list, |
2336 | &trans->transaction->pending_snapshots); | 2337 | &trans->transaction->pending_snapshots); |