Commit e21165bf authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'ceph-for-6.7-rc1' of https://github.com/ceph/ceph-client

Pull ceph updates from Ilya Dryomov:

 - support for idmapped mounts in CephFS (Christian Brauner, Alexander
   Mikhalitsyn).

   The series was originally developed by Christian and later picked up
   and brought over the finish line by Alexander, who also contributed
   an enabler on the MDS side (separate owner_{u,g}id fields on the
   wire).

   The required exports for mnt_idmap_{get,put}() in VFS have been acked
   by Christian and received no objection from Christoph.

 - a churny change in CephFS logging to include cluster and client
   identifiers in log and debug messages (Xiubo Li).

   This would help in scenarios with dozens of CephFS mounts on the same
   node which are getting increasingly common, especially in the
   Kubernetes world.

* tag 'ceph-for-6.7-rc1' of https://github.com/ceph/ceph-client:
  ceph: allow idmapped mounts
  ceph: allow idmapped atomic_open inode op
  ceph: allow idmapped set_acl inode op
  ceph: allow idmapped setattr inode op
  ceph: pass idmap to __ceph_setattr
  ceph: allow idmapped permission inode op
  ceph: allow idmapped getattr inode op
  ceph: pass an idmapping to mknod/symlink/mkdir
  ceph: add enable_unsafe_idmap module parameter
  ceph: handle idmapped mounts in create_request_message()
  ceph: stash idmapping in mdsc request
  fs: export mnt_idmap_get/mnt_idmap_put
  libceph, ceph: move mdsmap.h to fs/ceph
  ceph: print cluster fsid and client global_id in all debug logs
  ceph: rename _to_client() to _to_fs_client()
  ceph: pass the mdsc to several helpers
  libceph: add doutc and *_client debug macros support
parents 56d428ae 56d2e2cf
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include "super.h" #include "super.h"
#include "mds_client.h"
static inline void ceph_set_cached_acl(struct inode *inode, static inline void ceph_set_cached_acl(struct inode *inode,
int type, struct posix_acl *acl) int type, struct posix_acl *acl)
...@@ -31,6 +32,7 @@ static inline void ceph_set_cached_acl(struct inode *inode, ...@@ -31,6 +32,7 @@ static inline void ceph_set_cached_acl(struct inode *inode,
struct posix_acl *ceph_get_acl(struct inode *inode, int type, bool rcu) struct posix_acl *ceph_get_acl(struct inode *inode, int type, bool rcu)
{ {
struct ceph_client *cl = ceph_inode_to_client(inode);
int size; int size;
unsigned int retry_cnt = 0; unsigned int retry_cnt = 0;
const char *name; const char *name;
...@@ -72,7 +74,7 @@ struct posix_acl *ceph_get_acl(struct inode *inode, int type, bool rcu) ...@@ -72,7 +74,7 @@ struct posix_acl *ceph_get_acl(struct inode *inode, int type, bool rcu)
} else if (size == -ENODATA || size == 0) { } else if (size == -ENODATA || size == 0) {
acl = NULL; acl = NULL;
} else { } else {
pr_err_ratelimited("get acl %llx.%llx failed, err=%d\n", pr_err_ratelimited_client(cl, "%llx.%llx failed, err=%d\n",
ceph_vinop(inode), size); ceph_vinop(inode), size);
acl = ERR_PTR(-EIO); acl = ERR_PTR(-EIO);
} }
...@@ -105,7 +107,7 @@ int ceph_set_acl(struct mnt_idmap *idmap, struct dentry *dentry, ...@@ -105,7 +107,7 @@ int ceph_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
case ACL_TYPE_ACCESS: case ACL_TYPE_ACCESS:
name = XATTR_NAME_POSIX_ACL_ACCESS; name = XATTR_NAME_POSIX_ACL_ACCESS;
if (acl) { if (acl) {
ret = posix_acl_update_mode(&nop_mnt_idmap, inode, ret = posix_acl_update_mode(idmap, inode,
&new_mode, &acl); &new_mode, &acl);
if (ret) if (ret)
goto out; goto out;
...@@ -140,7 +142,7 @@ int ceph_set_acl(struct mnt_idmap *idmap, struct dentry *dentry, ...@@ -140,7 +142,7 @@ int ceph_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
newattrs.ia_ctime = current_time(inode); newattrs.ia_ctime = current_time(inode);
newattrs.ia_mode = new_mode; newattrs.ia_mode = new_mode;
newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
ret = __ceph_setattr(inode, &newattrs, NULL); ret = __ceph_setattr(idmap, inode, &newattrs, NULL);
if (ret) if (ret)
goto out_free; goto out_free;
} }
...@@ -151,7 +153,7 @@ int ceph_set_acl(struct mnt_idmap *idmap, struct dentry *dentry, ...@@ -151,7 +153,7 @@ int ceph_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
newattrs.ia_ctime = old_ctime; newattrs.ia_ctime = old_ctime;
newattrs.ia_mode = old_mode; newattrs.ia_mode = old_mode;
newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
__ceph_setattr(inode, &newattrs, NULL); __ceph_setattr(idmap, inode, &newattrs, NULL);
} }
goto out_free; goto out_free;
} }
......
This diff is collapsed.
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
void ceph_fscache_register_inode_cookie(struct inode *inode) void ceph_fscache_register_inode_cookie(struct inode *inode)
{ {
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_fs_client *fsc = ceph_inode_to_client(inode); struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
/* No caching for filesystem? */ /* No caching for filesystem? */
if (!fsc->fscache) if (!fsc->fscache)
......
This diff is collapsed.
...@@ -113,7 +113,7 @@ static int ceph_crypt_set_context(struct inode *inode, const void *ctx, ...@@ -113,7 +113,7 @@ static int ceph_crypt_set_context(struct inode *inode, const void *ctx,
cia.fscrypt_auth = cfa; cia.fscrypt_auth = cfa;
ret = __ceph_setattr(inode, &attr, &cia); ret = __ceph_setattr(&nop_mnt_idmap, inode, &attr, &cia);
if (ret == 0) if (ret == 0)
inode_set_flags(inode, S_ENCRYPTED, S_ENCRYPTED); inode_set_flags(inode, S_ENCRYPTED, S_ENCRYPTED);
kfree(cia.fscrypt_auth); kfree(cia.fscrypt_auth);
...@@ -129,7 +129,7 @@ static bool ceph_crypt_empty_dir(struct inode *inode) ...@@ -129,7 +129,7 @@ static bool ceph_crypt_empty_dir(struct inode *inode)
static const union fscrypt_policy *ceph_get_dummy_policy(struct super_block *sb) static const union fscrypt_policy *ceph_get_dummy_policy(struct super_block *sb)
{ {
return ceph_sb_to_client(sb)->fsc_dummy_enc_policy.policy; return ceph_sb_to_fs_client(sb)->fsc_dummy_enc_policy.policy;
} }
static struct fscrypt_operations ceph_fscrypt_ops = { static struct fscrypt_operations ceph_fscrypt_ops = {
...@@ -212,6 +212,7 @@ void ceph_fscrypt_as_ctx_to_req(struct ceph_mds_request *req, ...@@ -212,6 +212,7 @@ void ceph_fscrypt_as_ctx_to_req(struct ceph_mds_request *req,
static struct inode *parse_longname(const struct inode *parent, static struct inode *parse_longname(const struct inode *parent,
const char *name, int *name_len) const char *name, int *name_len)
{ {
struct ceph_client *cl = ceph_inode_to_client(parent);
struct inode *dir = NULL; struct inode *dir = NULL;
struct ceph_vino vino = { .snap = CEPH_NOSNAP }; struct ceph_vino vino = { .snap = CEPH_NOSNAP };
char *inode_number; char *inode_number;
...@@ -223,12 +224,12 @@ static struct inode *parse_longname(const struct inode *parent, ...@@ -223,12 +224,12 @@ static struct inode *parse_longname(const struct inode *parent,
name++; name++;
name_end = strrchr(name, '_'); name_end = strrchr(name, '_');
if (!name_end) { if (!name_end) {
dout("Failed to parse long snapshot name: %s\n", name); doutc(cl, "failed to parse long snapshot name: %s\n", name);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
} }
*name_len = (name_end - name); *name_len = (name_end - name);
if (*name_len <= 0) { if (*name_len <= 0) {
pr_err("Failed to parse long snapshot name\n"); pr_err_client(cl, "failed to parse long snapshot name\n");
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
} }
...@@ -240,7 +241,7 @@ static struct inode *parse_longname(const struct inode *parent, ...@@ -240,7 +241,7 @@ static struct inode *parse_longname(const struct inode *parent,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
ret = kstrtou64(inode_number, 10, &vino.ino); ret = kstrtou64(inode_number, 10, &vino.ino);
if (ret) { if (ret) {
dout("Failed to parse inode number: %s\n", name); doutc(cl, "failed to parse inode number: %s\n", name);
dir = ERR_PTR(ret); dir = ERR_PTR(ret);
goto out; goto out;
} }
...@@ -251,7 +252,7 @@ static struct inode *parse_longname(const struct inode *parent, ...@@ -251,7 +252,7 @@ static struct inode *parse_longname(const struct inode *parent,
/* This can happen if we're not mounting cephfs on the root */ /* This can happen if we're not mounting cephfs on the root */
dir = ceph_get_inode(parent->i_sb, vino, NULL); dir = ceph_get_inode(parent->i_sb, vino, NULL);
if (IS_ERR(dir)) if (IS_ERR(dir))
dout("Can't find inode %s (%s)\n", inode_number, name); doutc(cl, "can't find inode %s (%s)\n", inode_number, name);
} }
out: out:
...@@ -262,6 +263,7 @@ static struct inode *parse_longname(const struct inode *parent, ...@@ -262,6 +263,7 @@ static struct inode *parse_longname(const struct inode *parent,
int ceph_encode_encrypted_dname(struct inode *parent, struct qstr *d_name, int ceph_encode_encrypted_dname(struct inode *parent, struct qstr *d_name,
char *buf) char *buf)
{ {
struct ceph_client *cl = ceph_inode_to_client(parent);
struct inode *dir = parent; struct inode *dir = parent;
struct qstr iname; struct qstr iname;
u32 len; u32 len;
...@@ -330,7 +332,7 @@ int ceph_encode_encrypted_dname(struct inode *parent, struct qstr *d_name, ...@@ -330,7 +332,7 @@ int ceph_encode_encrypted_dname(struct inode *parent, struct qstr *d_name,
/* base64 encode the encrypted name */ /* base64 encode the encrypted name */
elen = ceph_base64_encode(cryptbuf, len, buf); elen = ceph_base64_encode(cryptbuf, len, buf);
dout("base64-encoded ciphertext name = %.*s\n", elen, buf); doutc(cl, "base64-encoded ciphertext name = %.*s\n", elen, buf);
/* To understand the 240 limit, see CEPH_NOHASH_NAME_MAX comments */ /* To understand the 240 limit, see CEPH_NOHASH_NAME_MAX comments */
WARN_ON(elen > 240); WARN_ON(elen > 240);
...@@ -505,7 +507,10 @@ int ceph_fscrypt_decrypt_block_inplace(const struct inode *inode, ...@@ -505,7 +507,10 @@ int ceph_fscrypt_decrypt_block_inplace(const struct inode *inode,
struct page *page, unsigned int len, struct page *page, unsigned int len,
unsigned int offs, u64 lblk_num) unsigned int offs, u64 lblk_num)
{ {
dout("%s: len %u offs %u blk %llu\n", __func__, len, offs, lblk_num); struct ceph_client *cl = ceph_inode_to_client(inode);
doutc(cl, "%p %llx.%llx len %u offs %u blk %llu\n", inode,
ceph_vinop(inode), len, offs, lblk_num);
return fscrypt_decrypt_block_inplace(inode, page, len, offs, lblk_num); return fscrypt_decrypt_block_inplace(inode, page, len, offs, lblk_num);
} }
...@@ -514,7 +519,10 @@ int ceph_fscrypt_encrypt_block_inplace(const struct inode *inode, ...@@ -514,7 +519,10 @@ int ceph_fscrypt_encrypt_block_inplace(const struct inode *inode,
unsigned int offs, u64 lblk_num, unsigned int offs, u64 lblk_num,
gfp_t gfp_flags) gfp_t gfp_flags)
{ {
dout("%s: len %u offs %u blk %llu\n", __func__, len, offs, lblk_num); struct ceph_client *cl = ceph_inode_to_client(inode);
doutc(cl, "%p %llx.%llx len %u offs %u blk %llu\n", inode,
ceph_vinop(inode), len, offs, lblk_num);
return fscrypt_encrypt_block_inplace(inode, page, len, offs, lblk_num, return fscrypt_encrypt_block_inplace(inode, page, len, offs, lblk_num,
gfp_flags); gfp_flags);
} }
...@@ -583,6 +591,7 @@ int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page, ...@@ -583,6 +591,7 @@ int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page,
u64 off, struct ceph_sparse_extent *map, u64 off, struct ceph_sparse_extent *map,
u32 ext_cnt) u32 ext_cnt)
{ {
struct ceph_client *cl = ceph_inode_to_client(inode);
int i, ret = 0; int i, ret = 0;
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
u64 objno, objoff; u64 objno, objoff;
...@@ -590,7 +599,8 @@ int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page, ...@@ -590,7 +599,8 @@ int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page,
/* Nothing to do for empty array */ /* Nothing to do for empty array */
if (ext_cnt == 0) { if (ext_cnt == 0) {
dout("%s: empty array, ret 0\n", __func__); doutc(cl, "%p %llx.%llx empty array, ret 0\n", inode,
ceph_vinop(inode));
return 0; return 0;
} }
...@@ -604,14 +614,17 @@ int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page, ...@@ -604,14 +614,17 @@ int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page,
int fret; int fret;
if ((ext->off | ext->len) & ~CEPH_FSCRYPT_BLOCK_MASK) { if ((ext->off | ext->len) & ~CEPH_FSCRYPT_BLOCK_MASK) {
pr_warn("%s: bad encrypted sparse extent idx %d off %llx len %llx\n", pr_warn_client(cl,
__func__, i, ext->off, ext->len); "%p %llx.%llx bad encrypted sparse extent "
"idx %d off %llx len %llx\n",
inode, ceph_vinop(inode), i, ext->off,
ext->len);
return -EIO; return -EIO;
} }
fret = ceph_fscrypt_decrypt_pages(inode, &page[pgidx], fret = ceph_fscrypt_decrypt_pages(inode, &page[pgidx],
off + pgsoff, ext->len); off + pgsoff, ext->len);
dout("%s: [%d] 0x%llx~0x%llx fret %d\n", __func__, i, doutc(cl, "%p %llx.%llx [%d] 0x%llx~0x%llx fret %d\n", inode,
ext->off, ext->len, fret); ceph_vinop(inode), i, ext->off, ext->len, fret);
if (fret < 0) { if (fret < 0) {
if (ret == 0) if (ret == 0)
ret = fret; ret = fret;
...@@ -619,7 +632,7 @@ int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page, ...@@ -619,7 +632,7 @@ int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page,
} }
ret = pgsoff + fret; ret = pgsoff + fret;
} }
dout("%s: ret %d\n", __func__, ret); doutc(cl, "ret %d\n", ret);
return ret; return ret;
} }
......
...@@ -81,7 +81,7 @@ static int mdsc_show(struct seq_file *s, void *p) ...@@ -81,7 +81,7 @@ static int mdsc_show(struct seq_file *s, void *p)
if (req->r_inode) { if (req->r_inode) {
seq_printf(s, " #%llx", ceph_ino(req->r_inode)); seq_printf(s, " #%llx", ceph_ino(req->r_inode));
} else if (req->r_dentry) { } else if (req->r_dentry) {
path = ceph_mdsc_build_path(req->r_dentry, &pathlen, path = ceph_mdsc_build_path(mdsc, req->r_dentry, &pathlen,
&pathbase, 0); &pathbase, 0);
if (IS_ERR(path)) if (IS_ERR(path))
path = NULL; path = NULL;
...@@ -100,7 +100,7 @@ static int mdsc_show(struct seq_file *s, void *p) ...@@ -100,7 +100,7 @@ static int mdsc_show(struct seq_file *s, void *p)
} }
if (req->r_old_dentry) { if (req->r_old_dentry) {
path = ceph_mdsc_build_path(req->r_old_dentry, &pathlen, path = ceph_mdsc_build_path(mdsc, req->r_old_dentry, &pathlen,
&pathbase, 0); &pathbase, 0);
if (IS_ERR(path)) if (IS_ERR(path))
path = NULL; path = NULL;
...@@ -398,7 +398,7 @@ DEFINE_SIMPLE_ATTRIBUTE(congestion_kb_fops, congestion_kb_get, ...@@ -398,7 +398,7 @@ DEFINE_SIMPLE_ATTRIBUTE(congestion_kb_fops, congestion_kb_get,
void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc) void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc)
{ {
dout("ceph_fs_debugfs_cleanup\n"); doutc(fsc->client, "begin\n");
debugfs_remove(fsc->debugfs_bdi); debugfs_remove(fsc->debugfs_bdi);
debugfs_remove(fsc->debugfs_congestion_kb); debugfs_remove(fsc->debugfs_congestion_kb);
debugfs_remove(fsc->debugfs_mdsmap); debugfs_remove(fsc->debugfs_mdsmap);
...@@ -407,13 +407,14 @@ void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc) ...@@ -407,13 +407,14 @@ void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc)
debugfs_remove(fsc->debugfs_status); debugfs_remove(fsc->debugfs_status);
debugfs_remove(fsc->debugfs_mdsc); debugfs_remove(fsc->debugfs_mdsc);
debugfs_remove_recursive(fsc->debugfs_metrics_dir); debugfs_remove_recursive(fsc->debugfs_metrics_dir);
doutc(fsc->client, "done\n");
} }
void ceph_fs_debugfs_init(struct ceph_fs_client *fsc) void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
{ {
char name[100]; char name[100];
dout("ceph_fs_debugfs_init\n"); doutc(fsc->client, "begin\n");
fsc->debugfs_congestion_kb = fsc->debugfs_congestion_kb =
debugfs_create_file("writeback_congestion_kb", debugfs_create_file("writeback_congestion_kb",
0600, 0600,
...@@ -469,6 +470,7 @@ void ceph_fs_debugfs_init(struct ceph_fs_client *fsc) ...@@ -469,6 +470,7 @@ void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
&metrics_size_fops); &metrics_size_fops);
debugfs_create_file("caps", 0400, fsc->debugfs_metrics_dir, fsc, debugfs_create_file("caps", 0400, fsc->debugfs_metrics_dir, fsc,
&metrics_caps_fops); &metrics_caps_fops);
doutc(fsc->client, "done\n");
} }
......
This diff is collapsed.
...@@ -36,6 +36,7 @@ struct ceph_nfs_snapfh { ...@@ -36,6 +36,7 @@ struct ceph_nfs_snapfh {
static int ceph_encode_snapfh(struct inode *inode, u32 *rawfh, int *max_len, static int ceph_encode_snapfh(struct inode *inode, u32 *rawfh, int *max_len,
struct inode *parent_inode) struct inode *parent_inode)
{ {
struct ceph_client *cl = ceph_inode_to_client(inode);
static const int snap_handle_length = static const int snap_handle_length =
sizeof(struct ceph_nfs_snapfh) >> 2; sizeof(struct ceph_nfs_snapfh) >> 2;
struct ceph_nfs_snapfh *sfh = (void *)rawfh; struct ceph_nfs_snapfh *sfh = (void *)rawfh;
...@@ -79,13 +80,14 @@ static int ceph_encode_snapfh(struct inode *inode, u32 *rawfh, int *max_len, ...@@ -79,13 +80,14 @@ static int ceph_encode_snapfh(struct inode *inode, u32 *rawfh, int *max_len,
*max_len = snap_handle_length; *max_len = snap_handle_length;
ret = FILEID_BTRFS_WITH_PARENT; ret = FILEID_BTRFS_WITH_PARENT;
out: out:
dout("encode_snapfh %llx.%llx ret=%d\n", ceph_vinop(inode), ret); doutc(cl, "%p %llx.%llx ret=%d\n", inode, ceph_vinop(inode), ret);
return ret; return ret;
} }
static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
struct inode *parent_inode) struct inode *parent_inode)
{ {
struct ceph_client *cl = ceph_inode_to_client(inode);
static const int handle_length = static const int handle_length =
sizeof(struct ceph_nfs_fh) >> 2; sizeof(struct ceph_nfs_fh) >> 2;
static const int connected_handle_length = static const int connected_handle_length =
...@@ -105,15 +107,15 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, ...@@ -105,15 +107,15 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
if (parent_inode) { if (parent_inode) {
struct ceph_nfs_confh *cfh = (void *)rawfh; struct ceph_nfs_confh *cfh = (void *)rawfh;
dout("encode_fh %llx with parent %llx\n", doutc(cl, "%p %llx.%llx with parent %p %llx.%llx\n", inode,
ceph_ino(inode), ceph_ino(parent_inode)); ceph_vinop(inode), parent_inode, ceph_vinop(parent_inode));
cfh->ino = ceph_ino(inode); cfh->ino = ceph_ino(inode);
cfh->parent_ino = ceph_ino(parent_inode); cfh->parent_ino = ceph_ino(parent_inode);
*max_len = connected_handle_length; *max_len = connected_handle_length;
type = FILEID_INO32_GEN_PARENT; type = FILEID_INO32_GEN_PARENT;
} else { } else {
struct ceph_nfs_fh *fh = (void *)rawfh; struct ceph_nfs_fh *fh = (void *)rawfh;
dout("encode_fh %llx\n", ceph_ino(inode)); doutc(cl, "%p %llx.%llx\n", inode, ceph_vinop(inode));
fh->ino = ceph_ino(inode); fh->ino = ceph_ino(inode);
*max_len = handle_length; *max_len = handle_length;
type = FILEID_INO32_GEN; type = FILEID_INO32_GEN;
...@@ -123,7 +125,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, ...@@ -123,7 +125,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
static struct inode *__lookup_inode(struct super_block *sb, u64 ino) static struct inode *__lookup_inode(struct super_block *sb, u64 ino)
{ {
struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(sb)->mdsc;
struct inode *inode; struct inode *inode;
struct ceph_vino vino; struct ceph_vino vino;
int err; int err;
...@@ -205,7 +207,8 @@ static struct dentry *__snapfh_to_dentry(struct super_block *sb, ...@@ -205,7 +207,8 @@ static struct dentry *__snapfh_to_dentry(struct super_block *sb,
struct ceph_nfs_snapfh *sfh, struct ceph_nfs_snapfh *sfh,
bool want_parent) bool want_parent)
{ {
struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(sb)->mdsc;
struct ceph_client *cl = mdsc->fsc->client;
struct ceph_mds_request *req; struct ceph_mds_request *req;
struct inode *inode; struct inode *inode;
struct ceph_vino vino; struct ceph_vino vino;
...@@ -278,11 +281,10 @@ static struct dentry *__snapfh_to_dentry(struct super_block *sb, ...@@ -278,11 +281,10 @@ static struct dentry *__snapfh_to_dentry(struct super_block *sb,
ceph_mdsc_put_request(req); ceph_mdsc_put_request(req);
if (want_parent) { if (want_parent) {
dout("snapfh_to_parent %llx.%llx\n err=%d\n", doutc(cl, "%llx.%llx\n err=%d\n", vino.ino, vino.snap, err);
vino.ino, vino.snap, err);
} else { } else {
dout("snapfh_to_dentry %llx.%llx parent %llx hash %x err=%d", doutc(cl, "%llx.%llx parent %llx hash %x err=%d", vino.ino,
vino.ino, vino.snap, sfh->parent_ino, sfh->hash, err); vino.snap, sfh->parent_ino, sfh->hash, err);
} }
if (IS_ERR(inode)) if (IS_ERR(inode))
return ERR_CAST(inode); return ERR_CAST(inode);
...@@ -297,6 +299,7 @@ static struct dentry *ceph_fh_to_dentry(struct super_block *sb, ...@@ -297,6 +299,7 @@ static struct dentry *ceph_fh_to_dentry(struct super_block *sb,
struct fid *fid, struct fid *fid,
int fh_len, int fh_type) int fh_len, int fh_type)
{ {
struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
struct ceph_nfs_fh *fh = (void *)fid->raw; struct ceph_nfs_fh *fh = (void *)fid->raw;
if (fh_type == FILEID_BTRFS_WITH_PARENT) { if (fh_type == FILEID_BTRFS_WITH_PARENT) {
...@@ -310,14 +313,14 @@ static struct dentry *ceph_fh_to_dentry(struct super_block *sb, ...@@ -310,14 +313,14 @@ static struct dentry *ceph_fh_to_dentry(struct super_block *sb,
if (fh_len < sizeof(*fh) / 4) if (fh_len < sizeof(*fh) / 4)
return NULL; return NULL;
dout("fh_to_dentry %llx\n", fh->ino); doutc(fsc->client, "%llx\n", fh->ino);
return __fh_to_dentry(sb, fh->ino); return __fh_to_dentry(sb, fh->ino);
} }
static struct dentry *__get_parent(struct super_block *sb, static struct dentry *__get_parent(struct super_block *sb,
struct dentry *child, u64 ino) struct dentry *child, u64 ino)
{ {
struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(sb)->mdsc;
struct ceph_mds_request *req; struct ceph_mds_request *req;
struct inode *inode; struct inode *inode;
int mask; int mask;
...@@ -363,6 +366,7 @@ static struct dentry *__get_parent(struct super_block *sb, ...@@ -363,6 +366,7 @@ static struct dentry *__get_parent(struct super_block *sb,
static struct dentry *ceph_get_parent(struct dentry *child) static struct dentry *ceph_get_parent(struct dentry *child)
{ {
struct inode *inode = d_inode(child); struct inode *inode = d_inode(child);
struct ceph_client *cl = ceph_inode_to_client(inode);
struct dentry *dn; struct dentry *dn;
if (ceph_snap(inode) != CEPH_NOSNAP) { if (ceph_snap(inode) != CEPH_NOSNAP) {
...@@ -402,8 +406,8 @@ static struct dentry *ceph_get_parent(struct dentry *child) ...@@ -402,8 +406,8 @@ static struct dentry *ceph_get_parent(struct dentry *child)
dn = __get_parent(child->d_sb, child, 0); dn = __get_parent(child->d_sb, child, 0);
} }
out: out:
dout("get_parent %p ino %llx.%llx err=%ld\n", doutc(cl, "child %p %p %llx.%llx err=%ld\n", child, inode,
child, ceph_vinop(inode), (long)PTR_ERR_OR_ZERO(dn)); ceph_vinop(inode), (long)PTR_ERR_OR_ZERO(dn));
return dn; return dn;
} }
...@@ -414,6 +418,7 @@ static struct dentry *ceph_fh_to_parent(struct super_block *sb, ...@@ -414,6 +418,7 @@ static struct dentry *ceph_fh_to_parent(struct super_block *sb,
struct fid *fid, struct fid *fid,
int fh_len, int fh_type) int fh_len, int fh_type)
{ {
struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
struct ceph_nfs_confh *cfh = (void *)fid->raw; struct ceph_nfs_confh *cfh = (void *)fid->raw;
struct dentry *dentry; struct dentry *dentry;
...@@ -427,7 +432,7 @@ static struct dentry *ceph_fh_to_parent(struct super_block *sb, ...@@ -427,7 +432,7 @@ static struct dentry *ceph_fh_to_parent(struct super_block *sb,
if (fh_len < sizeof(*cfh) / 4) if (fh_len < sizeof(*cfh) / 4)
return NULL; return NULL;
dout("fh_to_parent %llx\n", cfh->parent_ino); doutc(fsc->client, "%llx\n", cfh->parent_ino);
dentry = __get_parent(sb, NULL, cfh->ino); dentry = __get_parent(sb, NULL, cfh->ino);
if (unlikely(dentry == ERR_PTR(-ENOENT))) if (unlikely(dentry == ERR_PTR(-ENOENT)))
dentry = __fh_to_dentry(sb, cfh->parent_ino); dentry = __fh_to_dentry(sb, cfh->parent_ino);
...@@ -439,7 +444,7 @@ static int __get_snap_name(struct dentry *parent, char *name, ...@@ -439,7 +444,7 @@ static int __get_snap_name(struct dentry *parent, char *name,
{ {
struct inode *inode = d_inode(child); struct inode *inode = d_inode(child);
struct inode *dir = d_inode(parent); struct inode *dir = d_inode(parent);
struct ceph_fs_client *fsc = ceph_inode_to_client(inode); struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
struct ceph_mds_request *req = NULL; struct ceph_mds_request *req = NULL;
char *last_name = NULL; char *last_name = NULL;
unsigned next_offset = 2; unsigned next_offset = 2;
...@@ -526,8 +531,8 @@ static int __get_snap_name(struct dentry *parent, char *name, ...@@ -526,8 +531,8 @@ static int __get_snap_name(struct dentry *parent, char *name,
if (req) if (req)
ceph_mdsc_put_request(req); ceph_mdsc_put_request(req);
kfree(last_name); kfree(last_name);
dout("get_snap_name %p ino %llx.%llx err=%d\n", doutc(fsc->client, "child dentry %p %p %llx.%llx err=%d\n", child,
child, ceph_vinop(inode), err); inode, ceph_vinop(inode), err);
return err; return err;
} }
...@@ -544,7 +549,7 @@ static int ceph_get_name(struct dentry *parent, char *name, ...@@ -544,7 +549,7 @@ static int ceph_get_name(struct dentry *parent, char *name,
if (ceph_snap(inode) != CEPH_NOSNAP) if (ceph_snap(inode) != CEPH_NOSNAP)
return __get_snap_name(parent, name, child); return __get_snap_name(parent, name, child);
mdsc = ceph_inode_to_client(inode)->mdsc; mdsc = ceph_inode_to_fs_client(inode)->mdsc;
req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUPNAME, req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUPNAME,
USE_ANY_MDS); USE_ANY_MDS);
if (IS_ERR(req)) if (IS_ERR(req))
...@@ -588,9 +593,9 @@ static int ceph_get_name(struct dentry *parent, char *name, ...@@ -588,9 +593,9 @@ static int ceph_get_name(struct dentry *parent, char *name,
ceph_fname_free_buffer(dir, &oname); ceph_fname_free_buffer(dir, &oname);
} }
out: out:
dout("get_name %p ino %llx.%llx err %d %s%s\n", doutc(mdsc->fsc->client, "child dentry %p %p %llx.%llx err %d %s%s\n",
child, ceph_vinop(inode), err, child, inode, ceph_vinop(inode), err, err ? "" : "name ",
err ? "" : "name ", err ? "" : name); err ? "" : name);
ceph_mdsc_put_request(req); ceph_mdsc_put_request(req);
return err; return err;
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -65,7 +65,7 @@ static long __validate_layout(struct ceph_mds_client *mdsc, ...@@ -65,7 +65,7 @@ static long __validate_layout(struct ceph_mds_client *mdsc,
static long ceph_ioctl_set_layout(struct file *file, void __user *arg) static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
{ {
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc; struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
struct ceph_mds_request *req; struct ceph_mds_request *req;
struct ceph_ioctl_layout l; struct ceph_ioctl_layout l;
struct ceph_inode_info *ci = ceph_inode(file_inode(file)); struct ceph_inode_info *ci = ceph_inode(file_inode(file));
...@@ -140,7 +140,7 @@ static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg) ...@@ -140,7 +140,7 @@ static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg)
struct ceph_mds_request *req; struct ceph_mds_request *req;
struct ceph_ioctl_layout l; struct ceph_ioctl_layout l;
int err; int err;
struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc; struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
/* copy and validate */ /* copy and validate */
if (copy_from_user(&l, arg, sizeof(l))) if (copy_from_user(&l, arg, sizeof(l)))
...@@ -183,7 +183,7 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg) ...@@ -183,7 +183,7 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_osd_client *osdc = struct ceph_osd_client *osdc =
&ceph_sb_to_client(inode->i_sb)->client->osdc; &ceph_sb_to_fs_client(inode->i_sb)->client->osdc;
struct ceph_object_locator oloc; struct ceph_object_locator oloc;
CEPH_DEFINE_OID_ONSTACK(oid); CEPH_DEFINE_OID_ONSTACK(oid);
u32 xlen; u32 xlen;
...@@ -244,7 +244,8 @@ static long ceph_ioctl_lazyio(struct file *file) ...@@ -244,7 +244,8 @@ static long ceph_ioctl_lazyio(struct file *file)
struct ceph_file_info *fi = file->private_data; struct ceph_file_info *fi = file->private_data;
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc; struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
struct ceph_client *cl = mdsc->fsc->client;
if ((fi->fmode & CEPH_FILE_MODE_LAZY) == 0) { if ((fi->fmode & CEPH_FILE_MODE_LAZY) == 0) {
spin_lock(&ci->i_ceph_lock); spin_lock(&ci->i_ceph_lock);
...@@ -252,11 +253,13 @@ static long ceph_ioctl_lazyio(struct file *file) ...@@ -252,11 +253,13 @@ static long ceph_ioctl_lazyio(struct file *file)
ci->i_nr_by_mode[ffs(CEPH_FILE_MODE_LAZY)]++; ci->i_nr_by_mode[ffs(CEPH_FILE_MODE_LAZY)]++;
__ceph_touch_fmode(ci, mdsc, fi->fmode); __ceph_touch_fmode(ci, mdsc, fi->fmode);
spin_unlock(&ci->i_ceph_lock); spin_unlock(&ci->i_ceph_lock);
dout("ioctl_layzio: file %p marked lazy\n", file); doutc(cl, "file %p %p %llx.%llx marked lazy\n", file, inode,
ceph_vinop(inode));
ceph_check_caps(ci, 0); ceph_check_caps(ci, 0);
} else { } else {
dout("ioctl_layzio: file %p already lazy\n", file); doutc(cl, "file %p %p %llx.%llx already lazy\n", file, inode,
ceph_vinop(inode));
} }
return 0; return 0;
} }
...@@ -355,10 +358,12 @@ static const char *ceph_ioctl_cmd_name(const unsigned int cmd) ...@@ -355,10 +358,12 @@ static const char *ceph_ioctl_cmd_name(const unsigned int cmd)
long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg) long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
struct inode *inode = file_inode(file);
struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
int ret; int ret;
dout("ioctl file %p cmd %s arg %lu\n", file, doutc(fsc->client, "file %p %p %llx.%llx cmd %s arg %lu\n", file,
ceph_ioctl_cmd_name(cmd), arg); inode, ceph_vinop(inode), ceph_ioctl_cmd_name(cmd), arg);
switch (cmd) { switch (cmd) {
case CEPH_IOC_GET_LAYOUT: case CEPH_IOC_GET_LAYOUT:
return ceph_ioctl_get_layout(file, (void __user *)arg); return ceph_ioctl_get_layout(file, (void __user *)arg);
......
...@@ -77,6 +77,7 @@ static int ceph_lock_message(u8 lock_type, u16 operation, struct inode *inode, ...@@ -77,6 +77,7 @@ static int ceph_lock_message(u8 lock_type, u16 operation, struct inode *inode,
int cmd, u8 wait, struct file_lock *fl) int cmd, u8 wait, struct file_lock *fl)
{ {
struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb); struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb);
struct ceph_client *cl = mdsc->fsc->client;
struct ceph_mds_request *req; struct ceph_mds_request *req;
int err; int err;
u64 length = 0; u64 length = 0;
...@@ -111,10 +112,10 @@ static int ceph_lock_message(u8 lock_type, u16 operation, struct inode *inode, ...@@ -111,10 +112,10 @@ static int ceph_lock_message(u8 lock_type, u16 operation, struct inode *inode,
owner = secure_addr(fl->fl_owner); owner = secure_addr(fl->fl_owner);
dout("ceph_lock_message: rule: %d, op: %d, owner: %llx, pid: %llu, " doutc(cl, "rule: %d, op: %d, owner: %llx, pid: %llu, "
"start: %llu, length: %llu, wait: %d, type: %d\n", (int)lock_type, "start: %llu, length: %llu, wait: %d, type: %d\n",
(int)operation, owner, (u64)fl->fl_pid, fl->fl_start, length, (int)lock_type, (int)operation, owner, (u64)fl->fl_pid,
wait, fl->fl_type); fl->fl_start, length, wait, fl->fl_type);
req->r_args.filelock_change.rule = lock_type; req->r_args.filelock_change.rule = lock_type;
req->r_args.filelock_change.type = cmd; req->r_args.filelock_change.type = cmd;
...@@ -147,16 +148,17 @@ static int ceph_lock_message(u8 lock_type, u16 operation, struct inode *inode, ...@@ -147,16 +148,17 @@ static int ceph_lock_message(u8 lock_type, u16 operation, struct inode *inode,
} }
ceph_mdsc_put_request(req); ceph_mdsc_put_request(req);
dout("ceph_lock_message: rule: %d, op: %d, pid: %llu, start: %llu, " doutc(cl, "rule: %d, op: %d, pid: %llu, start: %llu, "
"length: %llu, wait: %d, type: %d, err code %d\n", (int)lock_type, "length: %llu, wait: %d, type: %d, err code %d\n",
(int)operation, (u64)fl->fl_pid, fl->fl_start, (int)lock_type, (int)operation, (u64)fl->fl_pid,
length, wait, fl->fl_type, err); fl->fl_start, length, wait, fl->fl_type, err);
return err; return err;
} }
static int ceph_lock_wait_for_completion(struct ceph_mds_client *mdsc, static int ceph_lock_wait_for_completion(struct ceph_mds_client *mdsc,
struct ceph_mds_request *req) struct ceph_mds_request *req)
{ {
struct ceph_client *cl = mdsc->fsc->client;
struct ceph_mds_request *intr_req; struct ceph_mds_request *intr_req;
struct inode *inode = req->r_inode; struct inode *inode = req->r_inode;
int err, lock_type; int err, lock_type;
...@@ -174,8 +176,7 @@ static int ceph_lock_wait_for_completion(struct ceph_mds_client *mdsc, ...@@ -174,8 +176,7 @@ static int ceph_lock_wait_for_completion(struct ceph_mds_client *mdsc,
if (!err) if (!err)
return 0; return 0;
dout("ceph_lock_wait_for_completion: request %llu was interrupted\n", doutc(cl, "request %llu was interrupted\n", req->r_tid);
req->r_tid);
mutex_lock(&mdsc->mutex); mutex_lock(&mdsc->mutex);
if (test_bit(CEPH_MDS_R_GOT_RESULT, &req->r_req_flags)) { if (test_bit(CEPH_MDS_R_GOT_RESULT, &req->r_req_flags)) {
...@@ -246,6 +247,7 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl) ...@@ -246,6 +247,7 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl)
{ {
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_client *cl = ceph_inode_to_client(inode);
int err = 0; int err = 0;
u16 op = CEPH_MDS_OP_SETFILELOCK; u16 op = CEPH_MDS_OP_SETFILELOCK;
u8 wait = 0; u8 wait = 0;
...@@ -257,7 +259,7 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl) ...@@ -257,7 +259,7 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl)
if (ceph_inode_is_shutdown(inode)) if (ceph_inode_is_shutdown(inode))
return -ESTALE; return -ESTALE;
dout("ceph_lock, fl_owner: %p\n", fl->fl_owner); doutc(cl, "fl_owner: %p\n", fl->fl_owner);
/* set wait bit as appropriate, then make command as Ceph expects it*/ /* set wait bit as appropriate, then make command as Ceph expects it*/
if (IS_GETLK(cmd)) if (IS_GETLK(cmd))
...@@ -292,7 +294,7 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl) ...@@ -292,7 +294,7 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl)
err = ceph_lock_message(CEPH_LOCK_FCNTL, op, inode, lock_cmd, wait, fl); err = ceph_lock_message(CEPH_LOCK_FCNTL, op, inode, lock_cmd, wait, fl);
if (!err) { if (!err) {
if (op == CEPH_MDS_OP_SETFILELOCK && F_UNLCK != fl->fl_type) { if (op == CEPH_MDS_OP_SETFILELOCK && F_UNLCK != fl->fl_type) {
dout("mds locked, locking locally\n"); doutc(cl, "locking locally\n");
err = posix_lock_file(file, fl, NULL); err = posix_lock_file(file, fl, NULL);
if (err) { if (err) {
/* undo! This should only happen if /* undo! This should only happen if
...@@ -300,7 +302,7 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl) ...@@ -300,7 +302,7 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl)
* deadlock. */ * deadlock. */
ceph_lock_message(CEPH_LOCK_FCNTL, op, inode, ceph_lock_message(CEPH_LOCK_FCNTL, op, inode,
CEPH_LOCK_UNLOCK, 0, fl); CEPH_LOCK_UNLOCK, 0, fl);
dout("got %d on posix_lock_file, undid lock\n", doutc(cl, "got %d on posix_lock_file, undid lock\n",
err); err);
} }
} }
...@@ -312,6 +314,7 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl) ...@@ -312,6 +314,7 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
{ {
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_client *cl = ceph_inode_to_client(inode);
int err = 0; int err = 0;
u8 wait = 0; u8 wait = 0;
u8 lock_cmd; u8 lock_cmd;
...@@ -322,7 +325,7 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl) ...@@ -322,7 +325,7 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
if (ceph_inode_is_shutdown(inode)) if (ceph_inode_is_shutdown(inode))
return -ESTALE; return -ESTALE;
dout("ceph_flock, fl_file: %p\n", fl->fl_file); doutc(cl, "fl_file: %p\n", fl->fl_file);
spin_lock(&ci->i_ceph_lock); spin_lock(&ci->i_ceph_lock);
if (ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) { if (ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) {
...@@ -359,7 +362,8 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl) ...@@ -359,7 +362,8 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
ceph_lock_message(CEPH_LOCK_FLOCK, ceph_lock_message(CEPH_LOCK_FLOCK,
CEPH_MDS_OP_SETFILELOCK, CEPH_MDS_OP_SETFILELOCK,
inode, CEPH_LOCK_UNLOCK, 0, fl); inode, CEPH_LOCK_UNLOCK, 0, fl);
dout("got %d on locks_lock_file_wait, undid lock\n", err); doutc(cl, "got %d on locks_lock_file_wait, undid lock\n",
err);
} }
} }
return err; return err;
...@@ -371,6 +375,7 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl) ...@@ -371,6 +375,7 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
*/ */
void ceph_count_locks(struct inode *inode, int *fcntl_count, int *flock_count) void ceph_count_locks(struct inode *inode, int *fcntl_count, int *flock_count)
{ {
struct ceph_client *cl = ceph_inode_to_client(inode);
struct file_lock *lock; struct file_lock *lock;
struct file_lock_context *ctx; struct file_lock_context *ctx;
...@@ -386,17 +391,20 @@ void ceph_count_locks(struct inode *inode, int *fcntl_count, int *flock_count) ...@@ -386,17 +391,20 @@ void ceph_count_locks(struct inode *inode, int *fcntl_count, int *flock_count)
++(*flock_count); ++(*flock_count);
spin_unlock(&ctx->flc_lock); spin_unlock(&ctx->flc_lock);
} }
dout("counted %d flock locks and %d fcntl locks\n", doutc(cl, "counted %d flock locks and %d fcntl locks\n",
*flock_count, *fcntl_count); *flock_count, *fcntl_count);
} }
/* /*
* Given a pointer to a lock, convert it to a ceph filelock * Given a pointer to a lock, convert it to a ceph filelock
*/ */
static int lock_to_ceph_filelock(struct file_lock *lock, static int lock_to_ceph_filelock(struct inode *inode,
struct file_lock *lock,
struct ceph_filelock *cephlock) struct ceph_filelock *cephlock)
{ {
struct ceph_client *cl = ceph_inode_to_client(inode);
int err = 0; int err = 0;
cephlock->start = cpu_to_le64(lock->fl_start); cephlock->start = cpu_to_le64(lock->fl_start);
cephlock->length = cpu_to_le64(lock->fl_end - lock->fl_start + 1); cephlock->length = cpu_to_le64(lock->fl_end - lock->fl_start + 1);
cephlock->client = cpu_to_le64(0); cephlock->client = cpu_to_le64(0);
...@@ -414,7 +422,7 @@ static int lock_to_ceph_filelock(struct file_lock *lock, ...@@ -414,7 +422,7 @@ static int lock_to_ceph_filelock(struct file_lock *lock,
cephlock->type = CEPH_LOCK_UNLOCK; cephlock->type = CEPH_LOCK_UNLOCK;
break; break;
default: default:
dout("Have unknown lock type %d\n", lock->fl_type); doutc(cl, "Have unknown lock type %d\n", lock->fl_type);
err = -EINVAL; err = -EINVAL;
} }
...@@ -432,12 +440,13 @@ int ceph_encode_locks_to_buffer(struct inode *inode, ...@@ -432,12 +440,13 @@ int ceph_encode_locks_to_buffer(struct inode *inode,
{ {
struct file_lock *lock; struct file_lock *lock;
struct file_lock_context *ctx = locks_inode_context(inode); struct file_lock_context *ctx = locks_inode_context(inode);
struct ceph_client *cl = ceph_inode_to_client(inode);
int err = 0; int err = 0;
int seen_fcntl = 0; int seen_fcntl = 0;
int seen_flock = 0; int seen_flock = 0;
int l = 0; int l = 0;
dout("encoding %d flock and %d fcntl locks\n", num_flock_locks, doutc(cl, "encoding %d flock and %d fcntl locks\n", num_flock_locks,
num_fcntl_locks); num_fcntl_locks);
if (!ctx) if (!ctx)
...@@ -450,7 +459,7 @@ int ceph_encode_locks_to_buffer(struct inode *inode, ...@@ -450,7 +459,7 @@ int ceph_encode_locks_to_buffer(struct inode *inode,
err = -ENOSPC; err = -ENOSPC;
goto fail; goto fail;
} }
err = lock_to_ceph_filelock(lock, &flocks[l]); err = lock_to_ceph_filelock(inode, lock, &flocks[l]);
if (err) if (err)
goto fail; goto fail;
++l; ++l;
...@@ -461,7 +470,7 @@ int ceph_encode_locks_to_buffer(struct inode *inode, ...@@ -461,7 +470,7 @@ int ceph_encode_locks_to_buffer(struct inode *inode,
err = -ENOSPC; err = -ENOSPC;
goto fail; goto fail;
} }
err = lock_to_ceph_filelock(lock, &flocks[l]); err = lock_to_ceph_filelock(inode, lock, &flocks[l]);
if (err) if (err)
goto fail; goto fail;
++l; ++l;
......
This diff is collapsed.
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
#include <linux/ceph/types.h> #include <linux/ceph/types.h>
#include <linux/ceph/messenger.h> #include <linux/ceph/messenger.h>
#include <linux/ceph/mdsmap.h>
#include <linux/ceph/auth.h> #include <linux/ceph/auth.h>
#include "mdsmap.h"
#include "metric.h" #include "metric.h"
#include "super.h" #include "super.h"
...@@ -33,8 +33,10 @@ enum ceph_feature_type { ...@@ -33,8 +33,10 @@ enum ceph_feature_type {
CEPHFS_FEATURE_NOTIFY_SESSION_STATE, CEPHFS_FEATURE_NOTIFY_SESSION_STATE,
CEPHFS_FEATURE_OP_GETVXATTR, CEPHFS_FEATURE_OP_GETVXATTR,
CEPHFS_FEATURE_32BITS_RETRY_FWD, CEPHFS_FEATURE_32BITS_RETRY_FWD,
CEPHFS_FEATURE_NEW_SNAPREALM_INFO,
CEPHFS_FEATURE_HAS_OWNER_UIDGID,
CEPHFS_FEATURE_MAX = CEPHFS_FEATURE_32BITS_RETRY_FWD, CEPHFS_FEATURE_MAX = CEPHFS_FEATURE_HAS_OWNER_UIDGID,
}; };
#define CEPHFS_FEATURES_CLIENT_SUPPORTED { \ #define CEPHFS_FEATURES_CLIENT_SUPPORTED { \
...@@ -49,6 +51,7 @@ enum ceph_feature_type { ...@@ -49,6 +51,7 @@ enum ceph_feature_type {
CEPHFS_FEATURE_NOTIFY_SESSION_STATE, \ CEPHFS_FEATURE_NOTIFY_SESSION_STATE, \
CEPHFS_FEATURE_OP_GETVXATTR, \ CEPHFS_FEATURE_OP_GETVXATTR, \
CEPHFS_FEATURE_32BITS_RETRY_FWD, \ CEPHFS_FEATURE_32BITS_RETRY_FWD, \
CEPHFS_FEATURE_HAS_OWNER_UIDGID, \
} }
/* /*
...@@ -300,6 +303,7 @@ struct ceph_mds_request { ...@@ -300,6 +303,7 @@ struct ceph_mds_request {
int r_fmode; /* file mode, if expecting cap */ int r_fmode; /* file mode, if expecting cap */
int r_request_release_offset; int r_request_release_offset;
const struct cred *r_cred; const struct cred *r_cred;
struct mnt_idmap *r_mnt_idmap;
struct timespec64 r_stamp; struct timespec64 r_stamp;
/* for choosing which mds to send this request to */ /* for choosing which mds to send this request to */
...@@ -581,7 +585,8 @@ static inline void ceph_mdsc_free_path(char *path, int len) ...@@ -581,7 +585,8 @@ static inline void ceph_mdsc_free_path(char *path, int len)
__putname(path - (PATH_MAX - 1 - len)); __putname(path - (PATH_MAX - 1 - len));
} }
extern char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *base, extern char *ceph_mdsc_build_path(struct ceph_mds_client *mdsc,
struct dentry *dentry, int *plen, u64 *base,
int for_wire); int for_wire);
extern void __ceph_mdsc_drop_dentry_lease(struct dentry *dentry); extern void __ceph_mdsc_drop_dentry_lease(struct dentry *dentry);
...@@ -614,4 +619,6 @@ static inline int ceph_wait_on_async_create(struct inode *inode) ...@@ -614,4 +619,6 @@ static inline int ceph_wait_on_async_create(struct inode *inode)
extern int ceph_wait_on_conflict_unlink(struct dentry *dentry); extern int ceph_wait_on_conflict_unlink(struct dentry *dentry);
extern u64 ceph_get_deleg_ino(struct ceph_mds_session *session); extern u64 ceph_get_deleg_ino(struct ceph_mds_session *session);
extern int ceph_restore_deleg_ino(struct ceph_mds_session *session, u64 ino); extern int ceph_restore_deleg_ino(struct ceph_mds_session *session, u64 ino);
extern bool enable_unsafe_idmap;
#endif #endif
...@@ -7,10 +7,11 @@ ...@@ -7,10 +7,11 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/ceph/mdsmap.h>
#include <linux/ceph/messenger.h> #include <linux/ceph/messenger.h>
#include <linux/ceph/decode.h> #include <linux/ceph/decode.h>
#include "mdsmap.h"
#include "mds_client.h"
#include "super.h" #include "super.h"
#define CEPH_MDS_IS_READY(i, ignore_laggy) \ #define CEPH_MDS_IS_READY(i, ignore_laggy) \
...@@ -114,8 +115,10 @@ static int __decode_and_drop_compat_set(void **p, void* end) ...@@ -114,8 +115,10 @@ static int __decode_and_drop_compat_set(void **p, void* end)
* Ignore any fields we don't care about (there are quite a few of * Ignore any fields we don't care about (there are quite a few of
* them). * them).
*/ */
struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2) struct ceph_mdsmap *ceph_mdsmap_decode(struct ceph_mds_client *mdsc, void **p,
void *end, bool msgr2)
{ {
struct ceph_client *cl = mdsc->fsc->client;
struct ceph_mdsmap *m; struct ceph_mdsmap *m;
const void *start = *p; const void *start = *p;
int i, j, n; int i, j, n;
...@@ -233,19 +236,17 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2) ...@@ -233,19 +236,17 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2)
*p = info_end; *p = info_end;
} }
dout("mdsmap_decode %d/%d %lld mds%d.%d %s %s%s\n", doutc(cl, "%d/%d %lld mds%d.%d %s %s%s\n", i+1, n, global_id,
i+1, n, global_id, mds, inc, mds, inc, ceph_pr_addr(&addr),
ceph_pr_addr(&addr), ceph_mds_state_name(state), laggy ? "(laggy)" : "");
ceph_mds_state_name(state),
laggy ? "(laggy)" : "");
if (mds < 0 || mds >= m->possible_max_rank) { if (mds < 0 || mds >= m->possible_max_rank) {
pr_warn("mdsmap_decode got incorrect mds(%d)\n", mds); pr_warn_client(cl, "got incorrect mds(%d)\n", mds);
continue; continue;
} }
if (state <= 0) { if (state <= 0) {
dout("mdsmap_decode got incorrect state(%s)\n", doutc(cl, "got incorrect state(%s)\n",
ceph_mds_state_name(state)); ceph_mds_state_name(state));
continue; continue;
} }
...@@ -385,16 +386,16 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2) ...@@ -385,16 +386,16 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2)
m->m_max_xattr_size = 0; m->m_max_xattr_size = 0;
} }
bad_ext: bad_ext:
dout("mdsmap_decode m_enabled: %d, m_damaged: %d, m_num_laggy: %d\n", doutc(cl, "m_enabled: %d, m_damaged: %d, m_num_laggy: %d\n",
!!m->m_enabled, !!m->m_damaged, m->m_num_laggy); !!m->m_enabled, !!m->m_damaged, m->m_num_laggy);
*p = end; *p = end;
dout("mdsmap_decode success epoch %u\n", m->m_epoch); doutc(cl, "success epoch %u\n", m->m_epoch);
return m; return m;
nomem: nomem:
err = -ENOMEM; err = -ENOMEM;
goto out_err; goto out_err;
corrupt: corrupt:
pr_err("corrupt mdsmap\n"); pr_err_client(cl, "corrupt mdsmap\n");
print_hex_dump(KERN_DEBUG, "mdsmap: ", print_hex_dump(KERN_DEBUG, "mdsmap: ",
DUMP_PREFIX_OFFSET, 16, 1, DUMP_PREFIX_OFFSET, 16, 1,
start, end - start, true); start, end - start, true);
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include <linux/bug.h> #include <linux/bug.h>
#include <linux/ceph/types.h> #include <linux/ceph/types.h>
struct ceph_mds_client;
/* /*
* mds map - describe servers in the mds cluster. * mds map - describe servers in the mds cluster.
* *
...@@ -65,7 +67,8 @@ static inline bool ceph_mdsmap_is_laggy(struct ceph_mdsmap *m, int w) ...@@ -65,7 +67,8 @@ static inline bool ceph_mdsmap_is_laggy(struct ceph_mdsmap *m, int w)
} }
extern int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m); extern int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m);
struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2); struct ceph_mdsmap *ceph_mdsmap_decode(struct ceph_mds_client *mdsc, void **p,
void *end, bool msgr2);
extern void ceph_mdsmap_destroy(struct ceph_mdsmap *m); extern void ceph_mdsmap_destroy(struct ceph_mdsmap *m);
extern bool ceph_mdsmap_is_cluster_available(struct ceph_mdsmap *m); extern bool ceph_mdsmap_is_cluster_available(struct ceph_mdsmap *m);
......
...@@ -31,6 +31,7 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc, ...@@ -31,6 +31,7 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
struct ceph_client_metric *m = &mdsc->metric; struct ceph_client_metric *m = &mdsc->metric;
u64 nr_caps = atomic64_read(&m->total_caps); u64 nr_caps = atomic64_read(&m->total_caps);
u32 header_len = sizeof(struct ceph_metric_header); u32 header_len = sizeof(struct ceph_metric_header);
struct ceph_client *cl = mdsc->fsc->client;
struct ceph_msg *msg; struct ceph_msg *msg;
s64 sum; s64 sum;
s32 items = 0; s32 items = 0;
...@@ -51,7 +52,7 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc, ...@@ -51,7 +52,7 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
msg = ceph_msg_new(CEPH_MSG_CLIENT_METRICS, len, GFP_NOFS, true); msg = ceph_msg_new(CEPH_MSG_CLIENT_METRICS, len, GFP_NOFS, true);
if (!msg) { if (!msg) {
pr_err("send metrics to mds%d, failed to allocate message\n", pr_err_client(cl, "to mds%d, failed to allocate message\n",
s->s_mds); s->s_mds);
return false; return false;
} }
......
...@@ -43,6 +43,7 @@ void ceph_handle_quota(struct ceph_mds_client *mdsc, ...@@ -43,6 +43,7 @@ void ceph_handle_quota(struct ceph_mds_client *mdsc,
{ {
struct super_block *sb = mdsc->fsc->sb; struct super_block *sb = mdsc->fsc->sb;
struct ceph_mds_quota *h = msg->front.iov_base; struct ceph_mds_quota *h = msg->front.iov_base;
struct ceph_client *cl = mdsc->fsc->client;
struct ceph_vino vino; struct ceph_vino vino;
struct inode *inode; struct inode *inode;
struct ceph_inode_info *ci; struct ceph_inode_info *ci;
...@@ -51,7 +52,7 @@ void ceph_handle_quota(struct ceph_mds_client *mdsc, ...@@ -51,7 +52,7 @@ void ceph_handle_quota(struct ceph_mds_client *mdsc,
return; return;
if (msg->front.iov_len < sizeof(*h)) { if (msg->front.iov_len < sizeof(*h)) {
pr_err("%s corrupt message mds%d len %d\n", __func__, pr_err_client(cl, "corrupt message mds%d len %d\n",
session->s_mds, (int)msg->front.iov_len); session->s_mds, (int)msg->front.iov_len);
ceph_msg_dump(msg); ceph_msg_dump(msg);
goto out; goto out;
...@@ -62,7 +63,7 @@ void ceph_handle_quota(struct ceph_mds_client *mdsc, ...@@ -62,7 +63,7 @@ void ceph_handle_quota(struct ceph_mds_client *mdsc,
vino.snap = CEPH_NOSNAP; vino.snap = CEPH_NOSNAP;
inode = ceph_find_inode(sb, vino); inode = ceph_find_inode(sb, vino);
if (!inode) { if (!inode) {
pr_warn("Failed to find inode %llu\n", vino.ino); pr_warn_client(cl, "failed to find inode %llx\n", vino.ino);
goto out; goto out;
} }
ci = ceph_inode(inode); ci = ceph_inode(inode);
...@@ -85,6 +86,7 @@ find_quotarealm_inode(struct ceph_mds_client *mdsc, u64 ino) ...@@ -85,6 +86,7 @@ find_quotarealm_inode(struct ceph_mds_client *mdsc, u64 ino)
{ {
struct ceph_quotarealm_inode *qri = NULL; struct ceph_quotarealm_inode *qri = NULL;
struct rb_node **node, *parent = NULL; struct rb_node **node, *parent = NULL;
struct ceph_client *cl = mdsc->fsc->client;
mutex_lock(&mdsc->quotarealms_inodes_mutex); mutex_lock(&mdsc->quotarealms_inodes_mutex);
node = &(mdsc->quotarealms_inodes.rb_node); node = &(mdsc->quotarealms_inodes.rb_node);
...@@ -110,7 +112,7 @@ find_quotarealm_inode(struct ceph_mds_client *mdsc, u64 ino) ...@@ -110,7 +112,7 @@ find_quotarealm_inode(struct ceph_mds_client *mdsc, u64 ino)
rb_link_node(&qri->node, parent, node); rb_link_node(&qri->node, parent, node);
rb_insert_color(&qri->node, &mdsc->quotarealms_inodes); rb_insert_color(&qri->node, &mdsc->quotarealms_inodes);
} else } else
pr_warn("Failed to alloc quotarealms_inode\n"); pr_warn_client(cl, "Failed to alloc quotarealms_inode\n");
} }
mutex_unlock(&mdsc->quotarealms_inodes_mutex); mutex_unlock(&mdsc->quotarealms_inodes_mutex);
...@@ -129,6 +131,7 @@ static struct inode *lookup_quotarealm_inode(struct ceph_mds_client *mdsc, ...@@ -129,6 +131,7 @@ static struct inode *lookup_quotarealm_inode(struct ceph_mds_client *mdsc,
struct super_block *sb, struct super_block *sb,
struct ceph_snap_realm *realm) struct ceph_snap_realm *realm)
{ {
struct ceph_client *cl = mdsc->fsc->client;
struct ceph_quotarealm_inode *qri; struct ceph_quotarealm_inode *qri;
struct inode *in; struct inode *in;
...@@ -161,8 +164,8 @@ static struct inode *lookup_quotarealm_inode(struct ceph_mds_client *mdsc, ...@@ -161,8 +164,8 @@ static struct inode *lookup_quotarealm_inode(struct ceph_mds_client *mdsc,
} }
if (IS_ERR(in)) { if (IS_ERR(in)) {
dout("Can't lookup inode %llx (err: %ld)\n", doutc(cl, "Can't lookup inode %llx (err: %ld)\n", realm->ino,
realm->ino, PTR_ERR(in)); PTR_ERR(in));
qri->timeout = jiffies + msecs_to_jiffies(60 * 1000); /* XXX */ qri->timeout = jiffies + msecs_to_jiffies(60 * 1000); /* XXX */
} else { } else {
qri->timeout = 0; qri->timeout = 0;
...@@ -213,6 +216,7 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc, ...@@ -213,6 +216,7 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,
enum quota_get_realm which_quota, enum quota_get_realm which_quota,
bool retry) bool retry)
{ {
struct ceph_client *cl = mdsc->fsc->client;
struct ceph_inode_info *ci = NULL; struct ceph_inode_info *ci = NULL;
struct ceph_snap_realm *realm, *next; struct ceph_snap_realm *realm, *next;
struct inode *in; struct inode *in;
...@@ -226,8 +230,9 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc, ...@@ -226,8 +230,9 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,
if (realm) if (realm)
ceph_get_snap_realm(mdsc, realm); ceph_get_snap_realm(mdsc, realm);
else else
pr_err_ratelimited("get_quota_realm: ino (%llx.%llx) " pr_err_ratelimited_client(cl,
"null i_snap_realm\n", ceph_vinop(inode)); "%p %llx.%llx null i_snap_realm\n",
inode, ceph_vinop(inode));
while (realm) { while (realm) {
bool has_inode; bool has_inode;
...@@ -317,6 +322,7 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op, ...@@ -317,6 +322,7 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
loff_t delta) loff_t delta)
{ {
struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb); struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb);
struct ceph_client *cl = mdsc->fsc->client;
struct ceph_inode_info *ci; struct ceph_inode_info *ci;
struct ceph_snap_realm *realm, *next; struct ceph_snap_realm *realm, *next;
struct inode *in; struct inode *in;
...@@ -332,8 +338,9 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op, ...@@ -332,8 +338,9 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
if (realm) if (realm)
ceph_get_snap_realm(mdsc, realm); ceph_get_snap_realm(mdsc, realm);
else else
pr_err_ratelimited("check_quota_exceeded: ino (%llx.%llx) " pr_err_ratelimited_client(cl,
"null i_snap_realm\n", ceph_vinop(inode)); "%p %llx.%llx null i_snap_realm\n",
inode, ceph_vinop(inode));
while (realm) { while (realm) {
bool has_inode; bool has_inode;
...@@ -383,7 +390,7 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op, ...@@ -383,7 +390,7 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
break; break;
default: default:
/* Shouldn't happen */ /* Shouldn't happen */
pr_warn("Invalid quota check op (%d)\n", op); pr_warn_client(cl, "Invalid quota check op (%d)\n", op);
exceeded = true; /* Just break the loop */ exceeded = true; /* Just break the loop */
} }
iput(in); iput(in);
......
This diff is collapsed.
This diff is collapsed.
...@@ -488,13 +488,13 @@ ceph_inode(const struct inode *inode) ...@@ -488,13 +488,13 @@ ceph_inode(const struct inode *inode)
} }
static inline struct ceph_fs_client * static inline struct ceph_fs_client *
ceph_inode_to_client(const struct inode *inode) ceph_inode_to_fs_client(const struct inode *inode)
{ {
return (struct ceph_fs_client *)inode->i_sb->s_fs_info; return (struct ceph_fs_client *)inode->i_sb->s_fs_info;
} }
static inline struct ceph_fs_client * static inline struct ceph_fs_client *
ceph_sb_to_client(const struct super_block *sb) ceph_sb_to_fs_client(const struct super_block *sb)
{ {
return (struct ceph_fs_client *)sb->s_fs_info; return (struct ceph_fs_client *)sb->s_fs_info;
} }
...@@ -502,7 +502,13 @@ ceph_sb_to_client(const struct super_block *sb) ...@@ -502,7 +502,13 @@ ceph_sb_to_client(const struct super_block *sb)
static inline struct ceph_mds_client * static inline struct ceph_mds_client *
ceph_sb_to_mdsc(const struct super_block *sb) ceph_sb_to_mdsc(const struct super_block *sb)
{ {
return (struct ceph_mds_client *)ceph_sb_to_client(sb)->mdsc; return (struct ceph_mds_client *)ceph_sb_to_fs_client(sb)->mdsc;
}
static inline struct ceph_client *
ceph_inode_to_client(const struct inode *inode)
{
return (struct ceph_client *)ceph_inode_to_fs_client(inode)->client;
} }
static inline struct ceph_vino static inline struct ceph_vino
...@@ -558,7 +564,7 @@ static inline u64 ceph_snap(struct inode *inode) ...@@ -558,7 +564,7 @@ static inline u64 ceph_snap(struct inode *inode)
*/ */
static inline u64 ceph_present_ino(struct super_block *sb, u64 ino) static inline u64 ceph_present_ino(struct super_block *sb, u64 ino)
{ {
if (unlikely(ceph_test_mount_opt(ceph_sb_to_client(sb), INO32))) if (unlikely(ceph_test_mount_opt(ceph_sb_to_fs_client(sb), INO32)))
return ceph_ino_to_ino32(ino); return ceph_ino_to_ino32(ino);
return ino; return ino;
} }
...@@ -1094,8 +1100,8 @@ struct ceph_iattr { ...@@ -1094,8 +1100,8 @@ struct ceph_iattr {
struct ceph_fscrypt_auth *fscrypt_auth; struct ceph_fscrypt_auth *fscrypt_auth;
}; };
extern int __ceph_setattr(struct inode *inode, struct iattr *attr, extern int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode,
struct ceph_iattr *cia); struct iattr *attr, struct ceph_iattr *cia);
extern int ceph_setattr(struct mnt_idmap *idmap, extern int ceph_setattr(struct mnt_idmap *idmap,
struct dentry *dentry, struct iattr *attr); struct dentry *dentry, struct iattr *attr);
extern int ceph_getattr(struct mnt_idmap *idmap, extern int ceph_getattr(struct mnt_idmap *idmap,
...@@ -1106,7 +1112,7 @@ void ceph_inode_shutdown(struct inode *inode); ...@@ -1106,7 +1112,7 @@ void ceph_inode_shutdown(struct inode *inode);
static inline bool ceph_inode_is_shutdown(struct inode *inode) static inline bool ceph_inode_is_shutdown(struct inode *inode)
{ {
unsigned long flags = READ_ONCE(ceph_inode(inode)->i_ceph_flags); unsigned long flags = READ_ONCE(ceph_inode(inode)->i_ceph_flags);
struct ceph_fs_client *fsc = ceph_inode_to_client(inode); struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
int state = READ_ONCE(fsc->mount_state); int state = READ_ONCE(fsc->mount_state);
return (flags & CEPH_I_SHUTDOWN) || state >= CEPH_MOUNT_SHUTDOWN; return (flags & CEPH_I_SHUTDOWN) || state >= CEPH_MOUNT_SHUTDOWN;
...@@ -1223,7 +1229,8 @@ extern void ceph_add_cap(struct inode *inode, ...@@ -1223,7 +1229,8 @@ extern void ceph_add_cap(struct inode *inode,
unsigned cap, unsigned seq, u64 realmino, int flags, unsigned cap, unsigned seq, u64 realmino, int flags,
struct ceph_cap **new_cap); struct ceph_cap **new_cap);
extern void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release); extern void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release);
extern void ceph_remove_cap(struct ceph_cap *cap, bool queue_release); extern void ceph_remove_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
bool queue_release);
extern void __ceph_remove_caps(struct ceph_inode_info *ci); extern void __ceph_remove_caps(struct ceph_inode_info *ci);
extern void ceph_put_cap(struct ceph_mds_client *mdsc, extern void ceph_put_cap(struct ceph_mds_client *mdsc,
struct ceph_cap *cap); struct ceph_cap *cap);
......
This diff is collapsed.
...@@ -256,6 +256,7 @@ struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap) ...@@ -256,6 +256,7 @@ struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap)
return idmap; return idmap;
} }
EXPORT_SYMBOL_GPL(mnt_idmap_get);
/** /**
* mnt_idmap_put - put a reference to an idmapping * mnt_idmap_put - put a reference to an idmapping
...@@ -271,3 +272,4 @@ void mnt_idmap_put(struct mnt_idmap *idmap) ...@@ -271,3 +272,4 @@ void mnt_idmap_put(struct mnt_idmap *idmap)
kfree(idmap); kfree(idmap);
} }
} }
EXPORT_SYMBOL_GPL(mnt_idmap_put);
...@@ -19,12 +19,25 @@ ...@@ -19,12 +19,25 @@
pr_debug("%.*s %12.12s:%-4d : " fmt, \ pr_debug("%.*s %12.12s:%-4d : " fmt, \
8 - (int)sizeof(KBUILD_MODNAME), " ", \ 8 - (int)sizeof(KBUILD_MODNAME), " ", \
kbasename(__FILE__), __LINE__, ##__VA_ARGS__) kbasename(__FILE__), __LINE__, ##__VA_ARGS__)
# define doutc(client, fmt, ...) \
pr_debug("%.*s %12.12s:%-4d : [%pU %llu] " fmt, \
8 - (int)sizeof(KBUILD_MODNAME), " ", \
kbasename(__FILE__), __LINE__, \
&client->fsid, client->monc.auth->global_id, \
##__VA_ARGS__)
# else # else
/* faux printk call just to see any compiler warnings. */ /* faux printk call just to see any compiler warnings. */
# define dout(fmt, ...) do { \ # define dout(fmt, ...) do { \
if (0) \ if (0) \
printk(KERN_DEBUG fmt, ##__VA_ARGS__); \ printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
} while (0) } while (0)
# define doutc(client, fmt, ...) do { \
if (0) \
printk(KERN_DEBUG "[%pU %llu] " fmt, \
&client->fsid, \
client->monc.auth->global_id, \
##__VA_ARGS__); \
} while (0)
# endif # endif
#else #else
...@@ -33,7 +46,32 @@ ...@@ -33,7 +46,32 @@
* or, just wrap pr_debug * or, just wrap pr_debug
*/ */
# define dout(fmt, ...) pr_debug(" " fmt, ##__VA_ARGS__) # define dout(fmt, ...) pr_debug(" " fmt, ##__VA_ARGS__)
# define doutc(client, fmt, ...) \
pr_debug(" [%pU %llu] %s: " fmt, &client->fsid, \
client->monc.auth->global_id, __func__, ##__VA_ARGS__)
#endif #endif
#define pr_notice_client(client, fmt, ...) \
pr_notice("[%pU %llu]: " fmt, &client->fsid, \
client->monc.auth->global_id, ##__VA_ARGS__)
#define pr_info_client(client, fmt, ...) \
pr_info("[%pU %llu]: " fmt, &client->fsid, \
client->monc.auth->global_id, ##__VA_ARGS__)
#define pr_warn_client(client, fmt, ...) \
pr_warn("[%pU %llu]: " fmt, &client->fsid, \
client->monc.auth->global_id, ##__VA_ARGS__)
#define pr_warn_once_client(client, fmt, ...) \
pr_warn_once("[%pU %llu]: " fmt, &client->fsid, \
client->monc.auth->global_id, ##__VA_ARGS__)
#define pr_err_client(client, fmt, ...) \
pr_err("[%pU %llu]: " fmt, &client->fsid, \
client->monc.auth->global_id, ##__VA_ARGS__)
#define pr_warn_ratelimited_client(client, fmt, ...) \
pr_warn_ratelimited("[%pU %llu]: " fmt, &client->fsid, \
client->monc.auth->global_id, ##__VA_ARGS__)
#define pr_err_ratelimited_client(client, fmt, ...) \
pr_err_ratelimited("[%pU %llu]: " fmt, &client->fsid, \
client->monc.auth->global_id, ##__VA_ARGS__)
#endif #endif
This diff is collapsed.
...@@ -115,6 +115,9 @@ static inline bool vfsgid_eq_kgid(vfsgid_t vfsgid, kgid_t kgid) ...@@ -115,6 +115,9 @@ static inline bool vfsgid_eq_kgid(vfsgid_t vfsgid, kgid_t kgid)
int vfsgid_in_group_p(vfsgid_t vfsgid); int vfsgid_in_group_p(vfsgid_t vfsgid);
struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap);
void mnt_idmap_put(struct mnt_idmap *idmap);
vfsuid_t make_vfsuid(struct mnt_idmap *idmap, vfsuid_t make_vfsuid(struct mnt_idmap *idmap,
struct user_namespace *fs_userns, kuid_t kuid); struct user_namespace *fs_userns, kuid_t kuid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment