aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYan <yanzheng@21cn.com>2008-01-17 11:59:51 -0500
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:59 -0400
commitfb4bc1e0565a842d704846005ac0ec739e608ede (patch)
treed4670954777c4e74ae2385521eeda3965acf4d5b
parentcaaca38b8fdcf63a17647fddae2195b189e19e37 (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>
-rw-r--r--fs/btrfs/acl.c5
-rw-r--r--fs/btrfs/inode.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index b4f85ebe1bd..27bb841fafe 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -22,6 +22,11 @@
#include <linux/posix_acl_xattr.h>
#include "ctree.h"
#include "xattr.h"
+#ifndef is_owner_or_cap
+#define is_owner_or_cap(inode) \
+ ((current->fsuid == (inode)->i_uid) || capable(CAP_FOWNER))
+#endif
+
static int btrfs_xattr_set_acl(struct inode *inode, int type,
const void *value, size_t size)
{
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c1ac0bcbb46..51fc06dc4a5 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)
ret = -ENOMEM;
goto fail_unlock;
}
- pending_snapshot->name = kstrndup(name, namelen, GFP_NOFS);
+ pending_snapshot->name = kmalloc(namelen + 1, GFP_NOFS);
if (!pending_snapshot->name) {
ret = -ENOMEM;
kfree(pending_snapshot);
goto fail_unlock;
}
+ memcpy(pending_snapshot->name, name, namelen);
+ pending_snapshot->name[namelen] = '\0';
trans = btrfs_start_transaction(root, 1);
BUG_ON(!trans);
-
pending_snapshot->root = root;
list_add(&pending_snapshot->list,
&trans->transaction->pending_snapshots);