Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First pile of statx patches #10922

Merged
merged 37 commits into from Sep 6, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
37eb3b4
client: pass a mask parameter to path_walk
jtlayton Aug 29, 2016
d0fc2a8
mds/mdstypes: add btime to inode
liewegas Aug 29, 2016
9591c51
mds/Server: set btime=ctime on creation
liewegas Aug 29, 2016
9cbfc47
mds/MDCache: set btime on system inodes
liewegas Aug 29, 2016
e292d2b
include/ceph_features: add FS_BTIME features
liewegas Aug 29, 2016
4349879
mds: pass btime in InodeStat MClientReply, if feature is present
liewegas Aug 29, 2016
e97e74a
client: keep btime in Inode and InodeStat
liewegas Aug 29, 2016
34c6d59
ceph: break up ll_getattr into two functions
jtlayton Aug 29, 2016
2115de0
client: move the device bitshift handling macros to Client.h
jtlayton Aug 29, 2016
f7c885e
libcephfs: add a ceph_ll_getattrx and ceph_statx
jtlayton Aug 29, 2016
639b482
libcephfs: add a test for "lazy" statx
jtlayton Aug 29, 2016
d0889aa
mds/client: add btime to CapSnap and MClientCaps
jtlayton Aug 29, 2016
6615553
mds/mdstypes: add change attribute to inode
jtlayton Aug 29, 2016
d7e185c
mds/Server: set change_attr to 0 on creation
jtlayton Aug 29, 2016
90cbea8
mds/MDCache: set change_attr to 0 on system_inodes
jtlayton Aug 29, 2016
6e7682b
include/ceph_features: add FS_CHANGE_ATTR feature
jtlayton Aug 29, 2016
b07a707
mds: pass change_attr in InodeStat MClientReply, if feature is present
jtlayton Aug 29, 2016
d3ff304
mds/client: keep change_attr in Inode, CapSnap and MClientCaps
jtlayton Aug 29, 2016
9025668
mds: ensure that change_attr reflects metadata changes on clients tha…
jtlayton Aug 29, 2016
b77605f
mds/client: bump the change_attr at the appropriate time for files
jtlayton Aug 29, 2016
50605be
libcephfs: return the change_attr in the statx.stx_version field
jtlayton Aug 29, 2016
925e0e7
tests: add a ChangeAttr test
jtlayton Aug 29, 2016
4d1eade
mds: make frag_info_t add_dirty() function take a pointer to touched_…
jtlayton Aug 29, 2016
0d441dc
mds: add change_attr to frag_info_t
jtlayton Aug 29, 2016
806991e
test: add test for change attribute of directories
jtlayton Aug 29, 2016
3148b67
cephfs: rename ceph_mds_request_head and _args with a _legacy postfix
jtlayton Aug 29, 2016
2bdc872
MDS: allow the MDS to accept requests to set the btime
jtlayton Aug 29, 2016
bce221c
client: add the ability to set the btime
jtlayton Aug 29, 2016
aa48835
client: add a ceph_fstatx
jtlayton Aug 29, 2016
c3efea6
client: extend the Btime test to cover fstatx as well
jtlayton Aug 29, 2016
41041d9
SQUASH: client: request AUTH caps on the directory during create if w…
jtlayton Sep 1, 2016
a9d6478
SQUASH: Revert "mds: ensure that change_attr reflects metadata change…
jtlayton Sep 1, 2016
0ac0551
SQUASH: client: always take a change_attr update from the server if i…
jtlayton Sep 1, 2016
44b102f
SQUASH: mds/client: don't get clever with ceph_mds_request_head_legac…
jtlayton Sep 1, 2016
821e77c
SQUASH: client: querying for stx_version field requires getting all s…
jtlayton Sep 1, 2016
7c59b9e
SQUASH: mds/client: add routines to copy to/from ceph_mds_request_hea…
jtlayton Sep 2, 2016
8e75bc1
SQUASH: client: request all shared caps if ctime was requested
jtlayton Sep 2, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 16 additions & 11 deletions src/client/Client.cc
Expand Up @@ -6032,7 +6032,7 @@ int Client::get_or_create(Inode *dir, const char* name,
}

int Client::path_walk(const filepath& origpath, InodeRef *end, bool followsym,
int uid, int gid)
int mask, int uid, int gid)
{
filepath path = origpath;
InodeRef cur;
Expand All @@ -6050,10 +6050,10 @@ int Client::path_walk(const filepath& origpath, InodeRef *end, bool followsym,
ldout(cct, 10) << "path_walk " << path << dendl;

int symlinks = 0;
int caps = 0;

unsigned i=0;
while (i < path.depth() && cur) {
int caps = 0;
const string &dname = path[i];
ldout(cct, 10) << " " << i << " " << *cur << " " << dname << dendl;
ldout(cct, 20) << " (path is " << path << ")" << dendl;
Expand All @@ -6064,6 +6064,11 @@ int Client::path_walk(const filepath& origpath, InodeRef *end, bool followsym,
return r;
caps = CEPH_CAP_AUTH_SHARED;
}

/* Get extra requested caps on the last component */
if (i == (path.depth() - 1))
caps |= mask;

int r = _lookup(cur.get(), dname, caps, &next, uid, gid);
if (r < 0)
return r;
Expand Down Expand Up @@ -6629,7 +6634,7 @@ int Client::stat(const char *relpath, struct stat *stbuf,
tout(cct) << relpath << std::endl;
filepath path(relpath);
InodeRef in;
int r = path_walk(path, &in);
int r = path_walk(path, &in, true, mask);
if (r < 0)
return r;
r = _getattr(in, mask);
Expand All @@ -6652,7 +6657,7 @@ int Client::lstat(const char *relpath, struct stat *stbuf,
filepath path(relpath);
InodeRef in;
// don't follow symlinks
int r = path_walk(path, &in, false);
int r = path_walk(path, &in, false, mask);
if (r < 0)
return r;
r = _getattr(in, mask);
Expand Down Expand Up @@ -7554,7 +7559,7 @@ int Client::open(const char *relpath, int flags, mode_t mode, int stripe_unit,
bool created = false;
/* O_CREATE with O_EXCL enforces O_NOFOLLOW. */
bool followsym = !((flags & O_NOFOLLOW) || ((flags & O_CREAT) && (flags & O_EXCL)));
int r = path_walk(path, &in, followsym, uid, gid);
int r = path_walk(path, &in, followsym, ceph_caps_for_mode(mode), uid, gid);

if (r == 0 && (flags & O_CREAT) && (flags & O_EXCL))
return -EEXIST;
Expand All @@ -7571,7 +7576,7 @@ int Client::open(const char *relpath, int flags, mode_t mode, int stripe_unit,
string dname = dirpath.last_dentry();
dirpath.pop_dentry();
InodeRef dir;
r = path_walk(dirpath, &dir, true, uid, gid);
r = path_walk(dirpath, &dir, true, 0, uid, gid);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably ought to request CEPH_CAP_AUTH_SHARED here if client_permissions is true. I'll plan to fold that into this patch once others have had a chance to comment.

if (r < 0)
goto out;
if (cct->_conf->client_permissions) {
Expand Down Expand Up @@ -9553,7 +9558,7 @@ int Client::ll_walk(const char* name, Inode **out, struct stat *attr)
tout(cct) << "ll_walk" << std::endl;
tout(cct) << name << std::endl;

rc = path_walk(fp, &in, false);
rc = path_walk(fp, &in, false, CEPH_STAT_CAP_INODE_ALL);
if (rc < 0) {
attr->st_ino = 0;
*out = NULL;
Expand Down Expand Up @@ -9739,7 +9744,7 @@ int Client::getxattr(const char *path, const char *name, void *value, size_t siz
{
Mutex::Locker lock(client_lock);
InodeRef in;
int r = Client::path_walk(path, &in, true);
int r = Client::path_walk(path, &in, true, CEPH_STAT_CAP_XATTR);
if (r < 0)
return r;
return _getxattr(in, name, value, size);
Expand All @@ -9749,7 +9754,7 @@ int Client::lgetxattr(const char *path, const char *name, void *value, size_t si
{
Mutex::Locker lock(client_lock);
InodeRef in;
int r = Client::path_walk(path, &in, false);
int r = Client::path_walk(path, &in, false, CEPH_STAT_CAP_XATTR);
if (r < 0)
return r;
return _getxattr(in, name, value, size);
Expand All @@ -9768,7 +9773,7 @@ int Client::listxattr(const char *path, char *list, size_t size)
{
Mutex::Locker lock(client_lock);
InodeRef in;
int r = Client::path_walk(path, &in, true);
int r = Client::path_walk(path, &in, true, CEPH_STAT_CAP_XATTR);
if (r < 0)
return r;
return Client::_listxattr(in.get(), list, size);
Expand All @@ -9778,7 +9783,7 @@ int Client::llistxattr(const char *path, char *list, size_t size)
{
Mutex::Locker lock(client_lock);
InodeRef in;
int r = Client::path_walk(path, &in, false);
int r = Client::path_walk(path, &in, false, CEPH_STAT_CAP_XATTR);
if (r < 0)
return r;
return Client::_listxattr(in.get(), list, size);
Expand Down
2 changes: 1 addition & 1 deletion src/client/Client.h
Expand Up @@ -519,7 +519,7 @@ class Client : public Dispatcher, public md_config_obs_t {
// path traversal for high-level interface
InodeRef cwd;
int path_walk(const filepath& fp, InodeRef *end, bool followsym=true,
int uid=-1, int gid=-1);
int mask=0, int uid=-1, int gid=-1);
int fill_stat(Inode *in, struct stat *st, frag_info_t *dirstat=0, nest_info_t *rstat=0);
int fill_stat(InodeRef& in, struct stat *st, frag_info_t *dirstat=0, nest_info_t *rstat=0) {
return fill_stat(in.get(), st, dirstat, rstat);
Expand Down