From 5b6ca82e5639a09f2dcb5f83a6023e15e3831637 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 9 Dec 2009 10:43:37 -0800 Subject: [PATCH] filestore: test xattrs on basedir/fsid, not basedir The basedir might have differing permissions. --- src/os/FileStore.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 7b0c78261fd3e..1f03fa80b28da 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -421,6 +421,10 @@ int FileStore::mount() fake_collections = true; } + // get fsid + char fn[PATH_MAX]; + sprintf(fn, "%s/fsid", basedir.c_str()); + // fake attrs? // let's test to see if they work. if (g_conf.filestore_fake_attrs) { @@ -429,8 +433,8 @@ int FileStore::mount() } else { int x = rand(); int y = x+1; - do_setxattr(basedir.c_str(), "user.test", &x, sizeof(x)); - do_getxattr(basedir.c_str(), "user.test", &y, sizeof(y)); + do_setxattr(fn, "user.test", &x, sizeof(x)); + do_getxattr(fn, "user.test", &y, sizeof(y)); /*dout(10) << "x = " << x << " y = " << y << " r1 = " << r1 << " r2 = " << r2 << " " << strerror(errno) @@ -441,10 +445,6 @@ int FileStore::mount() } } - char fn[PATH_MAX]; - - // get fsid - sprintf(fn, "%s/fsid", basedir.c_str()); fsid_fd = ::open(fn, O_RDWR|O_CREAT, 0644); ::read(fsid_fd, &fsid, sizeof(fsid)); -- 2.39.5