Skip to content

Commit 6467dfd

Browse files
committed
Merge tag 'ceph-for-6.11-rc1' of https://github.com/ceph/ceph-client
Pull ceph updates from Ilya Dryomov: "A small patchset to address bogus I/O errors and ultimately an assertion failure in the face of watch errors with -o exclusive mappings in RBD marked for stable and some assorted CephFS fixes" * tag 'ceph-for-6.11-rc1' of https://github.com/ceph/ceph-client: rbd: don't assume rbd_is_lock_owner() for exclusive mappings rbd: don't assume RBD_LOCK_STATE_LOCKED for exclusive mappings rbd: rename RBD_LOCK_STATE_RELEASING and releasing_wait ceph: fix incorrect kmalloc size of pagevec mempool ceph: periodically flush the cap releases ceph: convert comma to semicolon in __ceph_dentry_dir_lease_touch() ceph: use cap_wait_list only if debugfs is enabled
2 parents 732c275 + 3ceccb1 commit 6467dfd

File tree

6 files changed

+34
-22
lines changed

6 files changed

+34
-22
lines changed

drivers/block/rbd.c

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ enum rbd_watch_state {
362362
enum rbd_lock_state {
363363
RBD_LOCK_STATE_UNLOCKED,
364364
RBD_LOCK_STATE_LOCKED,
365-
RBD_LOCK_STATE_RELEASING,
365+
RBD_LOCK_STATE_QUIESCING,
366366
};
367367

368368
/* WatchNotify::ClientId */
@@ -422,7 +422,7 @@ struct rbd_device {
422422
struct list_head running_list;
423423
struct completion acquire_wait;
424424
int acquire_err;
425-
struct completion releasing_wait;
425+
struct completion quiescing_wait;
426426

427427
spinlock_t object_map_lock;
428428
u8 *object_map;
@@ -525,7 +525,7 @@ static bool __rbd_is_lock_owner(struct rbd_device *rbd_dev)
525525
lockdep_assert_held(&rbd_dev->lock_rwsem);
526526

527527
return rbd_dev->lock_state == RBD_LOCK_STATE_LOCKED ||
528-
rbd_dev->lock_state == RBD_LOCK_STATE_RELEASING;
528+
rbd_dev->lock_state == RBD_LOCK_STATE_QUIESCING;
529529
}
530530

531531
static bool rbd_is_lock_owner(struct rbd_device *rbd_dev)
@@ -3457,13 +3457,14 @@ static void rbd_lock_del_request(struct rbd_img_request *img_req)
34573457
lockdep_assert_held(&rbd_dev->lock_rwsem);
34583458
spin_lock(&rbd_dev->lock_lists_lock);
34593459
if (!list_empty(&img_req->lock_item)) {
3460+
rbd_assert(!list_empty(&rbd_dev->running_list));
34603461
list_del_init(&img_req->lock_item);
3461-
need_wakeup = (rbd_dev->lock_state == RBD_LOCK_STATE_RELEASING &&
3462+
need_wakeup = (rbd_dev->lock_state == RBD_LOCK_STATE_QUIESCING &&
34623463
list_empty(&rbd_dev->running_list));
34633464
}
34643465
spin_unlock(&rbd_dev->lock_lists_lock);
34653466
if (need_wakeup)
3466-
complete(&rbd_dev->releasing_wait);
3467+
complete(&rbd_dev->quiescing_wait);
34673468
}
34683469

34693470
static int rbd_img_exclusive_lock(struct rbd_img_request *img_req)
@@ -3476,11 +3477,6 @@ static int rbd_img_exclusive_lock(struct rbd_img_request *img_req)
34763477
if (rbd_lock_add_request(img_req))
34773478
return 1;
34783479

3479-
if (rbd_dev->opts->exclusive) {
3480-
WARN_ON(1); /* lock got released? */
3481-
return -EROFS;
3482-
}
3483-
34843480
/*
34853481
* Note the use of mod_delayed_work() in rbd_acquire_lock()
34863482
* and cancel_delayed_work() in wake_lock_waiters().
@@ -4181,16 +4177,16 @@ static bool rbd_quiesce_lock(struct rbd_device *rbd_dev)
41814177
/*
41824178
* Ensure that all in-flight IO is flushed.
41834179
*/
4184-
rbd_dev->lock_state = RBD_LOCK_STATE_RELEASING;
4185-
rbd_assert(!completion_done(&rbd_dev->releasing_wait));
4180+
rbd_dev->lock_state = RBD_LOCK_STATE_QUIESCING;
4181+
rbd_assert(!completion_done(&rbd_dev->quiescing_wait));
41864182
if (list_empty(&rbd_dev->running_list))
41874183
return true;
41884184

41894185
up_write(&rbd_dev->lock_rwsem);
4190-
wait_for_completion(&rbd_dev->releasing_wait);
4186+
wait_for_completion(&rbd_dev->quiescing_wait);
41914187

41924188
down_write(&rbd_dev->lock_rwsem);
4193-
if (rbd_dev->lock_state != RBD_LOCK_STATE_RELEASING)
4189+
if (rbd_dev->lock_state != RBD_LOCK_STATE_QUIESCING)
41944190
return false;
41954191

41964192
rbd_assert(list_empty(&rbd_dev->running_list));
@@ -4601,6 +4597,10 @@ static void rbd_reacquire_lock(struct rbd_device *rbd_dev)
46014597
rbd_warn(rbd_dev, "failed to update lock cookie: %d",
46024598
ret);
46034599

4600+
if (rbd_dev->opts->exclusive)
4601+
rbd_warn(rbd_dev,
4602+
"temporarily releasing lock on exclusive mapping");
4603+
46044604
/*
46054605
* Lock cookie cannot be updated on older OSDs, so do
46064606
* a manual release and queue an acquire.
@@ -5376,7 +5376,7 @@ static struct rbd_device *__rbd_dev_create(struct rbd_spec *spec)
53765376
INIT_LIST_HEAD(&rbd_dev->acquiring_list);
53775377
INIT_LIST_HEAD(&rbd_dev->running_list);
53785378
init_completion(&rbd_dev->acquire_wait);
5379-
init_completion(&rbd_dev->releasing_wait);
5379+
init_completion(&rbd_dev->quiescing_wait);
53805380

53815381
spin_lock_init(&rbd_dev->object_map_lock);
53825382

@@ -6582,11 +6582,6 @@ static int rbd_add_acquire_lock(struct rbd_device *rbd_dev)
65826582
if (ret)
65836583
return ret;
65846584

6585-
/*
6586-
* The lock may have been released by now, unless automatic lock
6587-
* transitions are disabled.
6588-
*/
6589-
rbd_assert(!rbd_dev->opts->exclusive || rbd_is_lock_owner(rbd_dev));
65906585
return 0;
65916586
}
65926587

fs/ceph/caps.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3067,10 +3067,13 @@ int __ceph_get_caps(struct inode *inode, struct ceph_file_info *fi, int need,
30673067
flags, &_got);
30683068
WARN_ON_ONCE(ret == -EAGAIN);
30693069
if (!ret) {
3070+
#ifdef CONFIG_DEBUG_FS
30703071
struct ceph_mds_client *mdsc = fsc->mdsc;
30713072
struct cap_wait cw;
3073+
#endif
30723074
DEFINE_WAIT_FUNC(wait, woken_wake_function);
30733075

3076+
#ifdef CONFIG_DEBUG_FS
30743077
cw.ino = ceph_ino(inode);
30753078
cw.tgid = current->tgid;
30763079
cw.need = need;
@@ -3079,6 +3082,7 @@ int __ceph_get_caps(struct inode *inode, struct ceph_file_info *fi, int need,
30793082
spin_lock(&mdsc->caps_list_lock);
30803083
list_add(&cw.list, &mdsc->cap_wait_list);
30813084
spin_unlock(&mdsc->caps_list_lock);
3085+
#endif
30823086

30833087
/* make sure used fmode not timeout */
30843088
ceph_get_fmode(ci, flags, FMODE_WAIT_BIAS);
@@ -3097,9 +3101,11 @@ int __ceph_get_caps(struct inode *inode, struct ceph_file_info *fi, int need,
30973101
remove_wait_queue(&ci->i_cap_wq, &wait);
30983102
ceph_put_fmode(ci, flags, FMODE_WAIT_BIAS);
30993103

3104+
#ifdef CONFIG_DEBUG_FS
31003105
spin_lock(&mdsc->caps_list_lock);
31013106
list_del(&cw.list);
31023107
spin_unlock(&mdsc->caps_list_lock);
3108+
#endif
31033109

31043110
if (ret == -EAGAIN)
31053111
continue;

fs/ceph/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,7 @@ void __ceph_dentry_dir_lease_touch(struct ceph_dentry_info *di)
15891589
}
15901590

15911591
spin_lock(&mdsc->dentry_list_lock);
1592-
__dentry_dir_lease_touch(mdsc, di),
1592+
__dentry_dir_lease_touch(mdsc, di);
15931593
spin_unlock(&mdsc->dentry_list_lock);
15941594
}
15951595

fs/ceph/mds_client.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5446,6 +5446,8 @@ static void delayed_work(struct work_struct *work)
54465446
}
54475447
mutex_unlock(&mdsc->mutex);
54485448

5449+
ceph_flush_cap_releases(mdsc, s);
5450+
54495451
mutex_lock(&s->s_mutex);
54505452
if (renew_caps)
54515453
send_renew_caps(mdsc, s);
@@ -5505,7 +5507,9 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
55055507
INIT_DELAYED_WORK(&mdsc->delayed_work, delayed_work);
55065508
mdsc->last_renew_caps = jiffies;
55075509
INIT_LIST_HEAD(&mdsc->cap_delay_list);
5510+
#ifdef CONFIG_DEBUG_FS
55085511
INIT_LIST_HEAD(&mdsc->cap_wait_list);
5512+
#endif
55095513
spin_lock_init(&mdsc->cap_delay_lock);
55105514
INIT_LIST_HEAD(&mdsc->cap_unlink_delay_list);
55115515
INIT_LIST_HEAD(&mdsc->snap_flush_list);

fs/ceph/mds_client.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,8 @@ struct ceph_quotarealm_inode {
416416
struct inode *inode;
417417
};
418418

419+
#ifdef CONFIG_DEBUG_FS
420+
419421
struct cap_wait {
420422
struct list_head list;
421423
u64 ino;
@@ -424,6 +426,8 @@ struct cap_wait {
424426
int want;
425427
};
426428

429+
#endif
430+
427431
enum {
428432
CEPH_MDSC_STOPPING_BEGIN = 1,
429433
CEPH_MDSC_STOPPING_FLUSHING = 2,
@@ -512,7 +516,9 @@ struct ceph_mds_client {
512516
spinlock_t caps_list_lock;
513517
struct list_head caps_list; /* unused (reserved or
514518
unreserved) */
519+
#ifdef CONFIG_DEBUG_FS
515520
struct list_head cap_wait_list;
521+
#endif
516522
int caps_total_count; /* total caps allocated */
517523
int caps_use_count; /* in use */
518524
int caps_use_max; /* max used caps */

fs/ceph/super.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,8 @@ static int __init init_caches(void)
961961
if (!ceph_mds_request_cachep)
962962
goto bad_mds_req;
963963

964-
ceph_wb_pagevec_pool = mempool_create_kmalloc_pool(10, CEPH_MAX_WRITE_SIZE >> PAGE_SHIFT);
964+
ceph_wb_pagevec_pool = mempool_create_kmalloc_pool(10,
965+
(CEPH_MAX_WRITE_SIZE >> PAGE_SHIFT) * sizeof(struct page *));
965966
if (!ceph_wb_pagevec_pool)
966967
goto bad_pagevec_pool;
967968

0 commit comments

Comments
 (0)