ceph: pass the request to parse_reply_info_readdir()
Instead of passing just the r_reply_info to the readdir reply parser, pass the request pointer directly instead. This will facilitate implementing readdir on fscrypted directories. Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Reviewed-and-tested-by: Luís Henriques <lhenriques@suse.de> Reviewed-by: Milind Changire <mchangir@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
855290962c
commit
3859af9eba
|
@ -407,9 +407,10 @@ out_bad:
|
||||||
* parse readdir results
|
* parse readdir results
|
||||||
*/
|
*/
|
||||||
static int parse_reply_info_readdir(void **p, void *end,
|
static int parse_reply_info_readdir(void **p, void *end,
|
||||||
struct ceph_mds_reply_info_parsed *info,
|
struct ceph_mds_request *req,
|
||||||
u64 features)
|
u64 features)
|
||||||
{
|
{
|
||||||
|
struct ceph_mds_reply_info_parsed *info = &req->r_reply_info;
|
||||||
u32 num, i = 0;
|
u32 num, i = 0;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -651,15 +652,16 @@ bad:
|
||||||
* parse extra results
|
* parse extra results
|
||||||
*/
|
*/
|
||||||
static int parse_reply_info_extra(void **p, void *end,
|
static int parse_reply_info_extra(void **p, void *end,
|
||||||
struct ceph_mds_reply_info_parsed *info,
|
struct ceph_mds_request *req,
|
||||||
u64 features, struct ceph_mds_session *s)
|
u64 features, struct ceph_mds_session *s)
|
||||||
{
|
{
|
||||||
|
struct ceph_mds_reply_info_parsed *info = &req->r_reply_info;
|
||||||
u32 op = le32_to_cpu(info->head->op);
|
u32 op = le32_to_cpu(info->head->op);
|
||||||
|
|
||||||
if (op == CEPH_MDS_OP_GETFILELOCK)
|
if (op == CEPH_MDS_OP_GETFILELOCK)
|
||||||
return parse_reply_info_filelock(p, end, info, features);
|
return parse_reply_info_filelock(p, end, info, features);
|
||||||
else if (op == CEPH_MDS_OP_READDIR || op == CEPH_MDS_OP_LSSNAP)
|
else if (op == CEPH_MDS_OP_READDIR || op == CEPH_MDS_OP_LSSNAP)
|
||||||
return parse_reply_info_readdir(p, end, info, features);
|
return parse_reply_info_readdir(p, end, req, features);
|
||||||
else if (op == CEPH_MDS_OP_CREATE)
|
else if (op == CEPH_MDS_OP_CREATE)
|
||||||
return parse_reply_info_create(p, end, info, features, s);
|
return parse_reply_info_create(p, end, info, features, s);
|
||||||
else if (op == CEPH_MDS_OP_GETVXATTR)
|
else if (op == CEPH_MDS_OP_GETVXATTR)
|
||||||
|
@ -672,9 +674,9 @@ static int parse_reply_info_extra(void **p, void *end,
|
||||||
* parse entire mds reply
|
* parse entire mds reply
|
||||||
*/
|
*/
|
||||||
static int parse_reply_info(struct ceph_mds_session *s, struct ceph_msg *msg,
|
static int parse_reply_info(struct ceph_mds_session *s, struct ceph_msg *msg,
|
||||||
struct ceph_mds_reply_info_parsed *info,
|
struct ceph_mds_request *req, u64 features)
|
||||||
u64 features)
|
|
||||||
{
|
{
|
||||||
|
struct ceph_mds_reply_info_parsed *info = &req->r_reply_info;
|
||||||
void *p, *end;
|
void *p, *end;
|
||||||
u32 len;
|
u32 len;
|
||||||
int err;
|
int err;
|
||||||
|
@ -696,7 +698,7 @@ static int parse_reply_info(struct ceph_mds_session *s, struct ceph_msg *msg,
|
||||||
ceph_decode_32_safe(&p, end, len, bad);
|
ceph_decode_32_safe(&p, end, len, bad);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
ceph_decode_need(&p, end, len, bad);
|
ceph_decode_need(&p, end, len, bad);
|
||||||
err = parse_reply_info_extra(&p, p+len, info, features, s);
|
err = parse_reply_info_extra(&p, p+len, req, features, s);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto out_bad;
|
goto out_bad;
|
||||||
}
|
}
|
||||||
|
@ -3598,14 +3600,15 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
dout("handle_reply tid %lld result %d\n", tid, result);
|
dout("handle_reply tid %lld result %d\n", tid, result);
|
||||||
rinfo = &req->r_reply_info;
|
|
||||||
if (test_bit(CEPHFS_FEATURE_REPLY_ENCODING, &session->s_features))
|
if (test_bit(CEPHFS_FEATURE_REPLY_ENCODING, &session->s_features))
|
||||||
err = parse_reply_info(session, msg, rinfo, (u64)-1);
|
err = parse_reply_info(session, msg, req, (u64)-1);
|
||||||
else
|
else
|
||||||
err = parse_reply_info(session, msg, rinfo, session->s_con.peer_features);
|
err = parse_reply_info(session, msg, req,
|
||||||
|
session->s_con.peer_features);
|
||||||
mutex_unlock(&mdsc->mutex);
|
mutex_unlock(&mdsc->mutex);
|
||||||
|
|
||||||
/* Must find target inode outside of mutexes to avoid deadlocks */
|
/* Must find target inode outside of mutexes to avoid deadlocks */
|
||||||
|
rinfo = &req->r_reply_info;
|
||||||
if ((err >= 0) && rinfo->head->is_target) {
|
if ((err >= 0) && rinfo->head->is_target) {
|
||||||
struct inode *in = xchg(&req->r_new_inode, NULL);
|
struct inode *in = xchg(&req->r_new_inode, NULL);
|
||||||
struct ceph_vino tvino = {
|
struct ceph_vino tvino = {
|
||||||
|
|
Loading…
Reference in New Issue