Skip to content

Commit c292fe4

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: libceph: Allocate larger oid buffer in request msgs ceph: initialize root dentry ceph: fix iput race when queueing inode work
2 parents 7758c4d + 224736d commit c292fe4

5 files changed

Lines changed: 19 additions & 8 deletions

File tree

‎fs/ceph/dir.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ static void ceph_d_prune(struct dentry *dentry)
11431143
{
11441144
struct ceph_dentry_info *di;
11451145

1146-
dout("d_release %p\n", dentry);
1146+
dout("ceph_d_prune %p\n", dentry);
11471147

11481148
/* do we have a valid parent? */
11491149
if (!dentry->d_parent || IS_ROOT(dentry))

‎fs/ceph/inode.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,12 +1328,13 @@ int ceph_inode_set_size(struct inode *inode, loff_t size)
13281328
*/
13291329
void ceph_queue_writeback(struct inode *inode)
13301330
{
1331+
ihold(inode);
13311332
if (queue_work(ceph_inode_to_client(inode)->wb_wq,
13321333
&ceph_inode(inode)->i_wb_work)) {
13331334
dout("ceph_queue_writeback %p\n", inode);
1334-
ihold(inode);
13351335
} else {
13361336
dout("ceph_queue_writeback %p failed\n", inode);
1337+
iput(inode);
13371338
}
13381339
}
13391340

@@ -1353,12 +1354,13 @@ static void ceph_writeback_work(struct work_struct *work)
13531354
*/
13541355
void ceph_queue_invalidate(struct inode *inode)
13551356
{
1357+
ihold(inode);
13561358
if (queue_work(ceph_inode_to_client(inode)->pg_inv_wq,
13571359
&ceph_inode(inode)->i_pg_inv_work)) {
13581360
dout("ceph_queue_invalidate %p\n", inode);
1359-
ihold(inode);
13601361
} else {
13611362
dout("ceph_queue_invalidate %p failed\n", inode);
1363+
iput(inode);
13621364
}
13631365
}
13641366

@@ -1434,13 +1436,14 @@ void ceph_queue_vmtruncate(struct inode *inode)
14341436
{
14351437
struct ceph_inode_info *ci = ceph_inode(inode);
14361438

1439+
ihold(inode);
14371440
if (queue_work(ceph_sb_to_client(inode->i_sb)->trunc_wq,
14381441
&ci->i_vmtruncate_work)) {
14391442
dout("ceph_queue_vmtruncate %p\n", inode);
1440-
ihold(inode);
14411443
} else {
14421444
dout("ceph_queue_vmtruncate %p failed, pending=%d\n",
14431445
inode, ci->i_truncate_pending);
1446+
iput(inode);
14441447
}
14451448
}
14461449

‎fs/ceph/super.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,10 +638,12 @@ static struct dentry *open_root_dentry(struct ceph_fs_client *fsc,
638638
if (err == 0) {
639639
dout("open_root_inode success\n");
640640
if (ceph_ino(req->r_target_inode) == CEPH_INO_ROOT &&
641-
fsc->sb->s_root == NULL)
641+
fsc->sb->s_root == NULL) {
642642
root = d_alloc_root(req->r_target_inode);
643-
else
643+
ceph_init_dentry(root);
644+
} else {
644645
root = d_obtain_alias(req->r_target_inode);
646+
}
645647
req->r_target_inode = NULL;
646648
dout("open_root_inode success, root dentry is %p\n", root);
647649
} else {

‎include/linux/ceph/osd_client.h‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
#include "osdmap.h"
1111
#include "messenger.h"
1212

13+
/*
14+
* Maximum object name size
15+
* (must be at least as big as RBD_MAX_MD_NAME_LEN -- currently 100)
16+
*/
17+
#define MAX_OBJ_NAME_SIZE 100
18+
1319
struct ceph_msg;
1420
struct ceph_snap_context;
1521
struct ceph_osd_request;
@@ -75,7 +81,7 @@ struct ceph_osd_request {
7581
struct inode *r_inode; /* for use by callbacks */
7682
void *r_priv; /* ditto */
7783

78-
char r_oid[40]; /* object name */
84+
char r_oid[MAX_OBJ_NAME_SIZE]; /* object name */
7985
int r_oid_len;
8086
unsigned long r_stamp; /* send OR check time */
8187

‎net/ceph/osd_client.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
244244
ceph_pagelist_init(req->r_trail);
245245
}
246246
/* create request message; allow space for oid */
247-
msg_size += 40;
247+
msg_size += MAX_OBJ_NAME_SIZE;
248248
if (snapc)
249249
msg_size += sizeof(u64) * snapc->num_snaps;
250250
if (use_mempool)

0 commit comments

Comments
 (0)