[driver-core:debugfs_cleanup 26/49] fs/ocfs2/dlmglue.c:3291:30: error: void value not ignored as it ought to be
kbuild test robot
lkp at intel.com
Mon Jul 22 07:38:35 UTC 2019
tree: https://kernel.googlesource.com/pub/scm/linux/kernel/git/gregkh/driver-core.git debugfs_cleanup
head: 7ea1b1929a3f463169713ae38bcacf4966e756af
commit: 54d5611ad33f517de1bfe958b22f57822743aebb [26/49] debugfs: remove return value of debugfs_create_u32()
config: x86_64-lkp (attached as .config)
compiler: gcc-7 (Debian 7.4.0-10) 7.4.0
reproduce:
git checkout 54d5611ad33f517de1bfe958b22f57822743aebb
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
fs/ocfs2/dlmglue.c: In function 'ocfs2_dlm_init_debug':
>> fs/ocfs2/dlmglue.c:3291:30: error: void value not ignored as it ought to be
dlm_debug->d_locking_filter = debugfs_create_u32("locking_filter",
^
vim +3291 fs/ocfs2/dlmglue.c
ccd979bdbce9fba Mark Fasheh 2005-12-15 3280
e581595ea29c737 Greg Kroah-Hartman 2019-07-11 3281 static void ocfs2_dlm_init_debug(struct ocfs2_super *osb)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3282 {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3283 struct ocfs2_dlm_debug *dlm_debug = osb->osb_dlm_debug;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3284
ccd979bdbce9fba Mark Fasheh 2005-12-15 3285 dlm_debug->d_locking_state = debugfs_create_file("locking_state",
ccd979bdbce9fba Mark Fasheh 2005-12-15 3286 S_IFREG|S_IRUSR,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3287 osb->osb_debug_root,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3288 osb,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3289 &ocfs2_dlm_debug_fops);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3290
8056773ac4b42f3 Gang He 2019-07-11 @3291 dlm_debug->d_locking_filter = debugfs_create_u32("locking_filter",
8056773ac4b42f3 Gang He 2019-07-11 3292 0600,
8056773ac4b42f3 Gang He 2019-07-11 3293 osb->osb_debug_root,
8056773ac4b42f3 Gang He 2019-07-11 3294 &dlm_debug->d_filter_secs);
29b0ea64bda81c7 Greg Kroah-Hartman 2019-01-04 3295
29b0ea64bda81c7 Greg Kroah-Hartman 2019-01-04 3296 ocfs2_get_dlm_debug(dlm_debug);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3297 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3298
ccd979bdbce9fba Mark Fasheh 2005-12-15 3299 static void ocfs2_dlm_shutdown_debug(struct ocfs2_super *osb)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3300 {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3301 struct ocfs2_dlm_debug *dlm_debug = osb->osb_dlm_debug;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3302
ccd979bdbce9fba Mark Fasheh 2005-12-15 3303 if (dlm_debug) {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3304 debugfs_remove(dlm_debug->d_locking_state);
8056773ac4b42f3 Gang He 2019-07-11 3305 debugfs_remove(dlm_debug->d_locking_filter);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3306 ocfs2_put_dlm_debug(dlm_debug);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3307 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3308 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3309
ccd979bdbce9fba Mark Fasheh 2005-12-15 3310 int ocfs2_dlm_init(struct ocfs2_super *osb)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3311 {
c271c5c22b0a7ca Sunil Mushran 2006-12-05 3312 int status = 0;
4670c46ded9a182 Joel Becker 2008-02-01 3313 struct ocfs2_cluster_connection *conn = NULL;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3314
0abd6d1803b01c7 Mark Fasheh 2008-01-29 3315 if (ocfs2_mount_local(osb)) {
0abd6d1803b01c7 Mark Fasheh 2008-01-29 3316 osb->node_num = 0;
c271c5c22b0a7ca Sunil Mushran 2006-12-05 3317 goto local;
0abd6d1803b01c7 Mark Fasheh 2008-01-29 3318 }
c271c5c22b0a7ca Sunil Mushran 2006-12-05 3319
e581595ea29c737 Greg Kroah-Hartman 2019-07-11 3320 ocfs2_dlm_init_debug(osb);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3321
34d024f84345807 Mark Fasheh 2007-09-24 3322 /* launch downconvert thread */
5afc44e2e9678c0 Joseph Qi 2015-11-05 3323 osb->dc_task = kthread_run(ocfs2_downconvert_thread, osb, "ocfs2dc-%s",
5afc44e2e9678c0 Joseph Qi 2015-11-05 3324 osb->uuid_str);
34d024f84345807 Mark Fasheh 2007-09-24 3325 if (IS_ERR(osb->dc_task)) {
34d024f84345807 Mark Fasheh 2007-09-24 3326 status = PTR_ERR(osb->dc_task);
34d024f84345807 Mark Fasheh 2007-09-24 3327 osb->dc_task = NULL;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3328 mlog_errno(status);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3329 goto bail;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3330 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3331
ccd979bdbce9fba Mark Fasheh 2005-12-15 3332 /* for now, uuid == domain */
9c6c877c04ce17d Joel Becker 2008-02-01 3333 status = ocfs2_cluster_connect(osb->osb_cluster_stack,
c74a3bdd9b529d9 Goldwyn Rodrigues 2014-01-21 3334 osb->osb_cluster_name,
c74a3bdd9b529d9 Goldwyn Rodrigues 2014-01-21 3335 strlen(osb->osb_cluster_name),
9c6c877c04ce17d Joel Becker 2008-02-01 3336 osb->uuid_str,
4670c46ded9a182 Joel Becker 2008-02-01 3337 strlen(osb->uuid_str),
553b5eb91abd5f8 Joel Becker 2010-01-29 3338 &lproto, ocfs2_do_node_down, osb,
4670c46ded9a182 Joel Becker 2008-02-01 3339 &conn);
4670c46ded9a182 Joel Becker 2008-02-01 3340 if (status) {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3341 mlog_errno(status);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3342 goto bail;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3343 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3344
3e8341516409d02 Goldwyn Rodrigues 2014-01-21 3345 status = ocfs2_cluster_this_node(conn, &osb->node_num);
0abd6d1803b01c7 Mark Fasheh 2008-01-29 3346 if (status < 0) {
0abd6d1803b01c7 Mark Fasheh 2008-01-29 3347 mlog_errno(status);
0abd6d1803b01c7 Mark Fasheh 2008-01-29 3348 mlog(ML_ERROR,
0abd6d1803b01c7 Mark Fasheh 2008-01-29 3349 "could not find this host's node number\n");
286eaa95c5c5915 Joel Becker 2008-02-01 3350 ocfs2_cluster_disconnect(conn, 0);
0abd6d1803b01c7 Mark Fasheh 2008-01-29 3351 goto bail;
0abd6d1803b01c7 Mark Fasheh 2008-01-29 3352 }
0abd6d1803b01c7 Mark Fasheh 2008-01-29 3353
c271c5c22b0a7ca Sunil Mushran 2006-12-05 3354 local:
ccd979bdbce9fba Mark Fasheh 2005-12-15 3355 ocfs2_super_lock_res_init(&osb->osb_super_lockres, osb);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3356 ocfs2_rename_lock_res_init(&osb->osb_rename_lockres, osb);
6ca497a83e592d6 wengang wang 2009-03-06 3357 ocfs2_nfs_sync_lock_res_init(&osb->osb_nfs_sync_lockres, osb);
83273932fbefb6c Srinivas Eeda 2009-06-03 3358 ocfs2_orphan_scan_lock_res_init(&osb->osb_orphan_scan.os_lockres, osb);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3359
4670c46ded9a182 Joel Becker 2008-02-01 3360 osb->cconn = conn;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3361 bail:
ccd979bdbce9fba Mark Fasheh 2005-12-15 3362 if (status < 0) {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3363 ocfs2_dlm_shutdown_debug(osb);
34d024f84345807 Mark Fasheh 2007-09-24 3364 if (osb->dc_task)
34d024f84345807 Mark Fasheh 2007-09-24 3365 kthread_stop(osb->dc_task);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3366 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3367
ccd979bdbce9fba Mark Fasheh 2005-12-15 3368 return status;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3369 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3370
286eaa95c5c5915 Joel Becker 2008-02-01 3371 void ocfs2_dlm_shutdown(struct ocfs2_super *osb,
286eaa95c5c5915 Joel Becker 2008-02-01 3372 int hangup_pending)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3373 {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3374 ocfs2_drop_osb_locks(osb);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3375
4670c46ded9a182 Joel Becker 2008-02-01 3376 /*
4670c46ded9a182 Joel Becker 2008-02-01 3377 * Now that we have dropped all locks and ocfs2_dismount_volume()
4670c46ded9a182 Joel Becker 2008-02-01 3378 * has disabled recovery, the DLM won't be talking to us. It's
4670c46ded9a182 Joel Becker 2008-02-01 3379 * safe to tear things down before disconnecting the cluster.
4670c46ded9a182 Joel Becker 2008-02-01 3380 */
4670c46ded9a182 Joel Becker 2008-02-01 3381
34d024f84345807 Mark Fasheh 2007-09-24 3382 if (osb->dc_task) {
34d024f84345807 Mark Fasheh 2007-09-24 3383 kthread_stop(osb->dc_task);
34d024f84345807 Mark Fasheh 2007-09-24 3384 osb->dc_task = NULL;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3385 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3386
ccd979bdbce9fba Mark Fasheh 2005-12-15 3387 ocfs2_lock_res_free(&osb->osb_super_lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3388 ocfs2_lock_res_free(&osb->osb_rename_lockres);
6ca497a83e592d6 wengang wang 2009-03-06 3389 ocfs2_lock_res_free(&osb->osb_nfs_sync_lockres);
83273932fbefb6c Srinivas Eeda 2009-06-03 3390 ocfs2_lock_res_free(&osb->osb_orphan_scan.os_lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3391
286eaa95c5c5915 Joel Becker 2008-02-01 3392 ocfs2_cluster_disconnect(osb->cconn, hangup_pending);
4670c46ded9a182 Joel Becker 2008-02-01 3393 osb->cconn = NULL;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3394
ccd979bdbce9fba Mark Fasheh 2005-12-15 3395 ocfs2_dlm_shutdown_debug(osb);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3396 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3397
ccd979bdbce9fba Mark Fasheh 2005-12-15 3398 static int ocfs2_drop_lock(struct ocfs2_super *osb,
0d5dc6c2dd7a3cd Mark Fasheh 2006-09-14 3399 struct ocfs2_lock_res *lockres)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3400 {
7431cd7e8dd0e46 Joel Becker 2008-02-01 3401 int ret;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3402 unsigned long flags;
bd3e76105d4478a Joel Becker 2008-02-01 3403 u32 lkm_flags = 0;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3404
ccd979bdbce9fba Mark Fasheh 2005-12-15 3405 /* We didn't get anywhere near actually using this lockres. */
ccd979bdbce9fba Mark Fasheh 2005-12-15 3406 if (!(lockres->l_flags & OCFS2_LOCK_INITIALIZED))
ccd979bdbce9fba Mark Fasheh 2005-12-15 3407 goto out;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3408
b80fc012e03f8f2 Mark Fasheh 2006-09-12 3409 if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB)
bd3e76105d4478a Joel Becker 2008-02-01 3410 lkm_flags |= DLM_LKF_VALBLK;
b80fc012e03f8f2 Mark Fasheh 2006-09-12 3411
ccd979bdbce9fba Mark Fasheh 2005-12-15 3412 spin_lock_irqsave(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3413
ccd979bdbce9fba Mark Fasheh 2005-12-15 3414 mlog_bug_on_msg(!(lockres->l_flags & OCFS2_LOCK_FREEING),
ccd979bdbce9fba Mark Fasheh 2005-12-15 3415 "lockres %s, flags 0x%lx\n",
ccd979bdbce9fba Mark Fasheh 2005-12-15 3416 lockres->l_name, lockres->l_flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3417
ccd979bdbce9fba Mark Fasheh 2005-12-15 3418 while (lockres->l_flags & OCFS2_LOCK_BUSY) {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3419 mlog(0, "waiting on busy lock \"%s\": flags = %lx, action = "
ccd979bdbce9fba Mark Fasheh 2005-12-15 3420 "%u, unlock_action = %u\n",
ccd979bdbce9fba Mark Fasheh 2005-12-15 3421 lockres->l_name, lockres->l_flags, lockres->l_action,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3422 lockres->l_unlock_action);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3423
ccd979bdbce9fba Mark Fasheh 2005-12-15 3424 spin_unlock_irqrestore(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3425
ccd979bdbce9fba Mark Fasheh 2005-12-15 3426 /* XXX: Today we just wait on any busy
ccd979bdbce9fba Mark Fasheh 2005-12-15 3427 * locks... Perhaps we need to cancel converts in the
ccd979bdbce9fba Mark Fasheh 2005-12-15 3428 * future? */
ccd979bdbce9fba Mark Fasheh 2005-12-15 3429 ocfs2_wait_on_busy_lock(lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3430
ccd979bdbce9fba Mark Fasheh 2005-12-15 3431 spin_lock_irqsave(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3432 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3433
0d5dc6c2dd7a3cd Mark Fasheh 2006-09-14 3434 if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB) {
0d5dc6c2dd7a3cd Mark Fasheh 2006-09-14 3435 if (lockres->l_flags & OCFS2_LOCK_ATTACHED &&
bd3e76105d4478a Joel Becker 2008-02-01 3436 lockres->l_level == DLM_LOCK_EX &&
0d5dc6c2dd7a3cd Mark Fasheh 2006-09-14 3437 !(lockres->l_flags & OCFS2_LOCK_NEEDS_REFRESH))
0d5dc6c2dd7a3cd Mark Fasheh 2006-09-14 3438 lockres->l_ops->set_lvb(lockres);
0d5dc6c2dd7a3cd Mark Fasheh 2006-09-14 3439 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3440
ccd979bdbce9fba Mark Fasheh 2005-12-15 3441 if (lockres->l_flags & OCFS2_LOCK_BUSY)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3442 mlog(ML_ERROR, "destroying busy lock: \"%s\"\n",
ccd979bdbce9fba Mark Fasheh 2005-12-15 3443 lockres->l_name);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3444 if (lockres->l_flags & OCFS2_LOCK_BLOCKED)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3445 mlog(0, "destroying blocked lock: \"%s\"\n", lockres->l_name);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3446
ccd979bdbce9fba Mark Fasheh 2005-12-15 3447 if (!(lockres->l_flags & OCFS2_LOCK_ATTACHED)) {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3448 spin_unlock_irqrestore(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3449 goto out;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3450 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3451
ccd979bdbce9fba Mark Fasheh 2005-12-15 3452 lockres_clear_flags(lockres, OCFS2_LOCK_ATTACHED);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3453
ccd979bdbce9fba Mark Fasheh 2005-12-15 3454 /* make sure we never get here while waiting for an ast to
ccd979bdbce9fba Mark Fasheh 2005-12-15 3455 * fire. */
ccd979bdbce9fba Mark Fasheh 2005-12-15 3456 BUG_ON(lockres->l_action != OCFS2_AST_INVALID);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3457
ccd979bdbce9fba Mark Fasheh 2005-12-15 3458 /* is this necessary? */
ccd979bdbce9fba Mark Fasheh 2005-12-15 3459 lockres_or_flags(lockres, OCFS2_LOCK_BUSY);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3460 lockres->l_unlock_action = OCFS2_UNLOCK_DROP_LOCK;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3461 spin_unlock_irqrestore(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3462
ccd979bdbce9fba Mark Fasheh 2005-12-15 3463 mlog(0, "lock %s\n", lockres->l_name);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3464
a796d2862aed811 Joel Becker 2010-01-28 3465 ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb, lkm_flags);
7431cd7e8dd0e46 Joel Becker 2008-02-01 3466 if (ret) {
7431cd7e8dd0e46 Joel Becker 2008-02-01 3467 ocfs2_log_dlm_error("ocfs2_dlm_unlock", ret, lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3468 mlog(ML_ERROR, "lockres flags: %lu\n", lockres->l_flags);
cf0acdcd640e946 Joel Becker 2008-01-29 3469 ocfs2_dlm_dump_lksb(&lockres->l_lksb);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3470 BUG();
ccd979bdbce9fba Mark Fasheh 2005-12-15 3471 }
73ac36ea14fd18e Coly Li 2009-01-07 3472 mlog(0, "lock %s, successful return from ocfs2_dlm_unlock\n",
ccd979bdbce9fba Mark Fasheh 2005-12-15 3473 lockres->l_name);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3474
ccd979bdbce9fba Mark Fasheh 2005-12-15 3475 ocfs2_wait_on_busy_lock(lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3476 out:
ccd979bdbce9fba Mark Fasheh 2005-12-15 3477 return 0;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3478 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3479
84d86f83f9d0e84 Jan Kara 2014-04-03 3480 static void ocfs2_process_blocked_lock(struct ocfs2_super *osb,
84d86f83f9d0e84 Jan Kara 2014-04-03 3481 struct ocfs2_lock_res *lockres);
84d86f83f9d0e84 Jan Kara 2014-04-03 3482
ccd979bdbce9fba Mark Fasheh 2005-12-15 3483 /* Mark the lockres as being dropped. It will no longer be
ccd979bdbce9fba Mark Fasheh 2005-12-15 3484 * queued if blocking, but we still may have to wait on it
34d024f84345807 Mark Fasheh 2007-09-24 3485 * being dequeued from the downconvert thread before we can consider
ccd979bdbce9fba Mark Fasheh 2005-12-15 3486 * it safe to drop.
ccd979bdbce9fba Mark Fasheh 2005-12-15 3487 *
ccd979bdbce9fba Mark Fasheh 2005-12-15 3488 * You can *not* attempt to call cluster_lock on this lockres anymore. */
84d86f83f9d0e84 Jan Kara 2014-04-03 3489 void ocfs2_mark_lockres_freeing(struct ocfs2_super *osb,
84d86f83f9d0e84 Jan Kara 2014-04-03 3490 struct ocfs2_lock_res *lockres)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3491 {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3492 int status;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3493 struct ocfs2_mask_waiter mw;
84d86f83f9d0e84 Jan Kara 2014-04-03 3494 unsigned long flags, flags2;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3495
ccd979bdbce9fba Mark Fasheh 2005-12-15 3496 ocfs2_init_mask_waiter(&mw);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3497
ccd979bdbce9fba Mark Fasheh 2005-12-15 3498 spin_lock_irqsave(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3499 lockres->l_flags |= OCFS2_LOCK_FREEING;
84d86f83f9d0e84 Jan Kara 2014-04-03 3500 if (lockres->l_flags & OCFS2_LOCK_QUEUED && current == osb->dc_task) {
84d86f83f9d0e84 Jan Kara 2014-04-03 3501 /*
84d86f83f9d0e84 Jan Kara 2014-04-03 3502 * We know the downconvert is queued but not in progress
84d86f83f9d0e84 Jan Kara 2014-04-03 3503 * because we are the downconvert thread and processing
84d86f83f9d0e84 Jan Kara 2014-04-03 3504 * different lock. So we can just remove the lock from the
84d86f83f9d0e84 Jan Kara 2014-04-03 3505 * queue. This is not only an optimization but also a way
84d86f83f9d0e84 Jan Kara 2014-04-03 3506 * to avoid the following deadlock:
84d86f83f9d0e84 Jan Kara 2014-04-03 3507 * ocfs2_dentry_post_unlock()
84d86f83f9d0e84 Jan Kara 2014-04-03 3508 * ocfs2_dentry_lock_put()
84d86f83f9d0e84 Jan Kara 2014-04-03 3509 * ocfs2_drop_dentry_lock()
84d86f83f9d0e84 Jan Kara 2014-04-03 3510 * iput()
84d86f83f9d0e84 Jan Kara 2014-04-03 3511 * ocfs2_evict_inode()
84d86f83f9d0e84 Jan Kara 2014-04-03 3512 * ocfs2_clear_inode()
84d86f83f9d0e84 Jan Kara 2014-04-03 3513 * ocfs2_mark_lockres_freeing()
84d86f83f9d0e84 Jan Kara 2014-04-03 3514 * ... blocks waiting for OCFS2_LOCK_QUEUED
84d86f83f9d0e84 Jan Kara 2014-04-03 3515 * since we are the downconvert thread which
84d86f83f9d0e84 Jan Kara 2014-04-03 3516 * should clear the flag.
84d86f83f9d0e84 Jan Kara 2014-04-03 3517 */
84d86f83f9d0e84 Jan Kara 2014-04-03 3518 spin_unlock_irqrestore(&lockres->l_lock, flags);
84d86f83f9d0e84 Jan Kara 2014-04-03 3519 spin_lock_irqsave(&osb->dc_task_lock, flags2);
84d86f83f9d0e84 Jan Kara 2014-04-03 3520 list_del_init(&lockres->l_blocked_list);
84d86f83f9d0e84 Jan Kara 2014-04-03 3521 osb->blocked_lock_count--;
84d86f83f9d0e84 Jan Kara 2014-04-03 3522 spin_unlock_irqrestore(&osb->dc_task_lock, flags2);
84d86f83f9d0e84 Jan Kara 2014-04-03 3523 /*
84d86f83f9d0e84 Jan Kara 2014-04-03 3524 * Warn if we recurse into another post_unlock call. Strictly
84d86f83f9d0e84 Jan Kara 2014-04-03 3525 * speaking it isn't a problem but we need to be careful if
84d86f83f9d0e84 Jan Kara 2014-04-03 3526 * that happens (stack overflow, deadlocks, ...) so warn if
84d86f83f9d0e84 Jan Kara 2014-04-03 3527 * ocfs2 grows a path for which this can happen.
84d86f83f9d0e84 Jan Kara 2014-04-03 3528 */
84d86f83f9d0e84 Jan Kara 2014-04-03 3529 WARN_ON_ONCE(lockres->l_ops->post_unlock);
84d86f83f9d0e84 Jan Kara 2014-04-03 3530 /* Since the lock is freeing we don't do much in the fn below */
84d86f83f9d0e84 Jan Kara 2014-04-03 3531 ocfs2_process_blocked_lock(osb, lockres);
84d86f83f9d0e84 Jan Kara 2014-04-03 3532 return;
84d86f83f9d0e84 Jan Kara 2014-04-03 3533 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3534 while (lockres->l_flags & OCFS2_LOCK_QUEUED) {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3535 lockres_add_mask_waiter(lockres, &mw, OCFS2_LOCK_QUEUED, 0);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3536 spin_unlock_irqrestore(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3537
ccd979bdbce9fba Mark Fasheh 2005-12-15 3538 mlog(0, "Waiting on lockres %s\n", lockres->l_name);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3539
ccd979bdbce9fba Mark Fasheh 2005-12-15 3540 status = ocfs2_wait_for_mask(&mw);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3541 if (status)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3542 mlog_errno(status);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3543
ccd979bdbce9fba Mark Fasheh 2005-12-15 3544 spin_lock_irqsave(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3545 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3546 spin_unlock_irqrestore(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3547 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3548
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3549 void ocfs2_simple_drop_lockres(struct ocfs2_super *osb,
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3550 struct ocfs2_lock_res *lockres)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3551 {
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3552 int ret;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3553
84d86f83f9d0e84 Jan Kara 2014-04-03 3554 ocfs2_mark_lockres_freeing(osb, lockres);
0d5dc6c2dd7a3cd Mark Fasheh 2006-09-14 3555 ret = ocfs2_drop_lock(osb, lockres);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3556 if (ret)
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3557 mlog_errno(ret);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3558 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3559
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3560 static void ocfs2_drop_osb_locks(struct ocfs2_super *osb)
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3561 {
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3562 ocfs2_simple_drop_lockres(osb, &osb->osb_super_lockres);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3563 ocfs2_simple_drop_lockres(osb, &osb->osb_rename_lockres);
6ca497a83e592d6 wengang wang 2009-03-06 3564 ocfs2_simple_drop_lockres(osb, &osb->osb_nfs_sync_lockres);
83273932fbefb6c Srinivas Eeda 2009-06-03 3565 ocfs2_simple_drop_lockres(osb, &osb->osb_orphan_scan.os_lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3566 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3567
ccd979bdbce9fba Mark Fasheh 2005-12-15 3568 int ocfs2_drop_inode_locks(struct inode *inode)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3569 {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3570 int status, err;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3571
ccd979bdbce9fba Mark Fasheh 2005-12-15 3572 /* No need to call ocfs2_mark_lockres_freeing here -
ccd979bdbce9fba Mark Fasheh 2005-12-15 3573 * ocfs2_clear_inode has done it for us. */
ccd979bdbce9fba Mark Fasheh 2005-12-15 3574
ccd979bdbce9fba Mark Fasheh 2005-12-15 3575 err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb),
500086300e6dc53 Tiger Yang 2007-03-20 3576 &OCFS2_I(inode)->ip_open_lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3577 if (err < 0)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3578 mlog_errno(err);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3579
ccd979bdbce9fba Mark Fasheh 2005-12-15 3580 status = err;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3581
ccd979bdbce9fba Mark Fasheh 2005-12-15 3582 err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb),
e63aecb651ba73d Mark Fasheh 2007-10-18 3583 &OCFS2_I(inode)->ip_inode_lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3584 if (err < 0)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3585 mlog_errno(err);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3586 if (err < 0 && !status)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3587 status = err;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3588
ccd979bdbce9fba Mark Fasheh 2005-12-15 3589 err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb),
0d5dc6c2dd7a3cd Mark Fasheh 2006-09-14 3590 &OCFS2_I(inode)->ip_rw_lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3591 if (err < 0)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3592 mlog_errno(err);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3593 if (err < 0 && !status)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3594 status = err;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3595
ccd979bdbce9fba Mark Fasheh 2005-12-15 3596 return status;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3597 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3598
de551246e7bc555 Joel Becker 2008-02-01 3599 static unsigned int ocfs2_prepare_downconvert(struct ocfs2_lock_res *lockres,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3600 int new_level)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3601 {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3602 assert_spin_locked(&lockres->l_lock);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3603
bd3e76105d4478a Joel Becker 2008-02-01 3604 BUG_ON(lockres->l_blocking <= DLM_LOCK_NL);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3605
ccd979bdbce9fba Mark Fasheh 2005-12-15 3606 if (lockres->l_level <= new_level) {
9b915181af0a99f Sunil Mushran 2010-02-26 3607 mlog(ML_ERROR, "lockres %s, lvl %d <= %d, blcklst %d, mask %d, "
9b915181af0a99f Sunil Mushran 2010-02-26 3608 "type %d, flags 0x%lx, hold %d %d, act %d %d, req %d, "
9b915181af0a99f Sunil Mushran 2010-02-26 3609 "block %d, pgen %d\n", lockres->l_name, lockres->l_level,
9b915181af0a99f Sunil Mushran 2010-02-26 3610 new_level, list_empty(&lockres->l_blocked_list),
9b915181af0a99f Sunil Mushran 2010-02-26 3611 list_empty(&lockres->l_mask_waiters), lockres->l_type,
9b915181af0a99f Sunil Mushran 2010-02-26 3612 lockres->l_flags, lockres->l_ro_holders,
9b915181af0a99f Sunil Mushran 2010-02-26 3613 lockres->l_ex_holders, lockres->l_action,
9b915181af0a99f Sunil Mushran 2010-02-26 3614 lockres->l_unlock_action, lockres->l_requested,
9b915181af0a99f Sunil Mushran 2010-02-26 3615 lockres->l_blocking, lockres->l_pending_gen);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3616 BUG();
ccd979bdbce9fba Mark Fasheh 2005-12-15 3617 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3618
9b915181af0a99f Sunil Mushran 2010-02-26 3619 mlog(ML_BASTS, "lockres %s, level %d => %d, blocking %d\n",
9b915181af0a99f Sunil Mushran 2010-02-26 3620 lockres->l_name, lockres->l_level, new_level, lockres->l_blocking);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3621
ccd979bdbce9fba Mark Fasheh 2005-12-15 3622 lockres->l_action = OCFS2_AST_DOWNCONVERT;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3623 lockres->l_requested = new_level;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3624 lockres_or_flags(lockres, OCFS2_LOCK_BUSY);
de551246e7bc555 Joel Becker 2008-02-01 3625 return lockres_set_pending(lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3626 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3627
ccd979bdbce9fba Mark Fasheh 2005-12-15 3628 static int ocfs2_downconvert_lock(struct ocfs2_super *osb,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3629 struct ocfs2_lock_res *lockres,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3630 int new_level,
de551246e7bc555 Joel Becker 2008-02-01 3631 int lvb,
de551246e7bc555 Joel Becker 2008-02-01 3632 unsigned int generation)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3633 {
bd3e76105d4478a Joel Becker 2008-02-01 3634 int ret;
bd3e76105d4478a Joel Becker 2008-02-01 3635 u32 dlm_flags = DLM_LKF_CONVERT;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3636
9b915181af0a99f Sunil Mushran 2010-02-26 3637 mlog(ML_BASTS, "lockres %s, level %d => %d\n", lockres->l_name,
9b915181af0a99f Sunil Mushran 2010-02-26 3638 lockres->l_level, new_level);
9b915181af0a99f Sunil Mushran 2010-02-26 3639
e7ee2c089e94067 Eric Ren 2017-01-10 3640 /*
e7ee2c089e94067 Eric Ren 2017-01-10 3641 * On DLM_LKF_VALBLK, fsdlm behaves differently with o2cb. It always
e7ee2c089e94067 Eric Ren 2017-01-10 3642 * expects DLM_LKF_VALBLK being set if the LKB has LVB, so that
e7ee2c089e94067 Eric Ren 2017-01-10 3643 * we can recover correctly from node failure. Otherwise, we may get
793057e1c7272a4 Ingo Molnar 2018-02-28 3644 * invalid LVB in LKB, but without DLM_SBF_VALNOTVALID being set.
e7ee2c089e94067 Eric Ren 2017-01-10 3645 */
a634644751c4623 Gang He 2018-11-02 3646 if (ocfs2_userspace_stack(osb) &&
e7ee2c089e94067 Eric Ren 2017-01-10 3647 lockres->l_ops->flags & LOCK_TYPE_USES_LVB)
e7ee2c089e94067 Eric Ren 2017-01-10 3648 lvb = 1;
e7ee2c089e94067 Eric Ren 2017-01-10 3649
ccd979bdbce9fba Mark Fasheh 2005-12-15 3650 if (lvb)
bd3e76105d4478a Joel Becker 2008-02-01 3651 dlm_flags |= DLM_LKF_VALBLK;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3652
4670c46ded9a182 Joel Becker 2008-02-01 3653 ret = ocfs2_dlm_lock(osb->cconn,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3654 new_level,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3655 &lockres->l_lksb,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3656 dlm_flags,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3657 lockres->l_name,
a796d2862aed811 Joel Becker 2010-01-28 3658 OCFS2_LOCK_ID_MAX_LEN - 1);
de551246e7bc555 Joel Becker 2008-02-01 3659 lockres_clear_pending(lockres, generation, osb);
7431cd7e8dd0e46 Joel Becker 2008-02-01 3660 if (ret) {
7431cd7e8dd0e46 Joel Becker 2008-02-01 3661 ocfs2_log_dlm_error("ocfs2_dlm_lock", ret, lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3662 ocfs2_recover_from_dlm_error(lockres, 1);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3663 goto bail;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3664 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3665
ccd979bdbce9fba Mark Fasheh 2005-12-15 3666 ret = 0;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3667 bail:
ccd979bdbce9fba Mark Fasheh 2005-12-15 3668 return ret;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3669 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3670
24ef1815e5e13e5 Joel Becker 2008-01-29 3671 /* returns 1 when the caller should unlock and call ocfs2_dlm_unlock */
ccd979bdbce9fba Mark Fasheh 2005-12-15 3672 static int ocfs2_prepare_cancel_convert(struct ocfs2_super *osb,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3673 struct ocfs2_lock_res *lockres)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3674 {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3675 assert_spin_locked(&lockres->l_lock);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3676
ccd979bdbce9fba Mark Fasheh 2005-12-15 3677 if (lockres->l_unlock_action == OCFS2_UNLOCK_CANCEL_CONVERT) {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3678 /* If we're already trying to cancel a lock conversion
ccd979bdbce9fba Mark Fasheh 2005-12-15 3679 * then just drop the spinlock and allow the caller to
ccd979bdbce9fba Mark Fasheh 2005-12-15 3680 * requeue this lock. */
9b915181af0a99f Sunil Mushran 2010-02-26 3681 mlog(ML_BASTS, "lockres %s, skip convert\n", lockres->l_name);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3682 return 0;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3683 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3684
ccd979bdbce9fba Mark Fasheh 2005-12-15 3685 /* were we in a convert when we got the bast fire? */
ccd979bdbce9fba Mark Fasheh 2005-12-15 3686 BUG_ON(lockres->l_action != OCFS2_AST_CONVERT &&
ccd979bdbce9fba Mark Fasheh 2005-12-15 3687 lockres->l_action != OCFS2_AST_DOWNCONVERT);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3688 /* set things up for the unlockast to know to just
ccd979bdbce9fba Mark Fasheh 2005-12-15 3689 * clear out the ast_action and unset busy, etc. */
ccd979bdbce9fba Mark Fasheh 2005-12-15 3690 lockres->l_unlock_action = OCFS2_UNLOCK_CANCEL_CONVERT;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3691
ccd979bdbce9fba Mark Fasheh 2005-12-15 3692 mlog_bug_on_msg(!(lockres->l_flags & OCFS2_LOCK_BUSY),
ccd979bdbce9fba Mark Fasheh 2005-12-15 3693 "lock %s, invalid flags: 0x%lx\n",
ccd979bdbce9fba Mark Fasheh 2005-12-15 3694 lockres->l_name, lockres->l_flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3695
9b915181af0a99f Sunil Mushran 2010-02-26 3696 mlog(ML_BASTS, "lockres %s\n", lockres->l_name);
9b915181af0a99f Sunil Mushran 2010-02-26 3697
ccd979bdbce9fba Mark Fasheh 2005-12-15 3698 return 1;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3699 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3700
ccd979bdbce9fba Mark Fasheh 2005-12-15 3701 static int ocfs2_cancel_convert(struct ocfs2_super *osb,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3702 struct ocfs2_lock_res *lockres)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3703 {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3704 int ret;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3705
4670c46ded9a182 Joel Becker 2008-02-01 3706 ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb,
a796d2862aed811 Joel Becker 2010-01-28 3707 DLM_LKF_CANCEL);
7431cd7e8dd0e46 Joel Becker 2008-02-01 3708 if (ret) {
7431cd7e8dd0e46 Joel Becker 2008-02-01 3709 ocfs2_log_dlm_error("ocfs2_dlm_unlock", ret, lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3710 ocfs2_recover_from_dlm_error(lockres, 0);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3711 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3712
9b915181af0a99f Sunil Mushran 2010-02-26 3713 mlog(ML_BASTS, "lockres %s\n", lockres->l_name);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3714
ccd979bdbce9fba Mark Fasheh 2005-12-15 3715 return ret;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3716 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3717
b5e500e23e53279 Mark Fasheh 2006-09-13 3718 static int ocfs2_unblock_lock(struct ocfs2_super *osb,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3719 struct ocfs2_lock_res *lockres,
cc567d89b3af429 Mark Fasheh 2006-09-13 3720 struct ocfs2_unblock_ctl *ctl)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3721 {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3722 unsigned long flags;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3723 int blocking;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3724 int new_level;
079b805782f94f4 Sunil Mushran 2010-02-03 3725 int level;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3726 int ret = 0;
5ef0d4ea0877409 Mark Fasheh 2006-09-13 3727 int set_lvb = 0;
de551246e7bc555 Joel Becker 2008-02-01 3728 unsigned int gen;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3729
ccd979bdbce9fba Mark Fasheh 2005-12-15 3730 spin_lock_irqsave(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3731
ccd979bdbce9fba Mark Fasheh 2005-12-15 3732 recheck:
db0f6ce69776370 Sunil Mushran 2010-02-01 3733 /*
db0f6ce69776370 Sunil Mushran 2010-02-01 3734 * Is it still blocking? If not, we have no more work to do.
db0f6ce69776370 Sunil Mushran 2010-02-01 3735 */
db0f6ce69776370 Sunil Mushran 2010-02-01 3736 if (!(lockres->l_flags & OCFS2_LOCK_BLOCKED)) {
db0f6ce69776370 Sunil Mushran 2010-02-01 3737 BUG_ON(lockres->l_blocking != DLM_LOCK_NL);
db0f6ce69776370 Sunil Mushran 2010-02-01 3738 spin_unlock_irqrestore(&lockres->l_lock, flags);
db0f6ce69776370 Sunil Mushran 2010-02-01 3739 ret = 0;
db0f6ce69776370 Sunil Mushran 2010-02-01 3740 goto leave;
db0f6ce69776370 Sunil Mushran 2010-02-01 3741 }
db0f6ce69776370 Sunil Mushran 2010-02-01 3742
ccd979bdbce9fba Mark Fasheh 2005-12-15 3743 if (lockres->l_flags & OCFS2_LOCK_BUSY) {
de551246e7bc555 Joel Becker 2008-02-01 3744 /* XXX
de551246e7bc555 Joel Becker 2008-02-01 3745 * This is a *big* race. The OCFS2_LOCK_PENDING flag
de551246e7bc555 Joel Becker 2008-02-01 3746 * exists entirely for one reason - another thread has set
de551246e7bc555 Joel Becker 2008-02-01 3747 * OCFS2_LOCK_BUSY, but has *NOT* yet called dlm_lock().
de551246e7bc555 Joel Becker 2008-02-01 3748 *
de551246e7bc555 Joel Becker 2008-02-01 3749 * If we do ocfs2_cancel_convert() before the other thread
de551246e7bc555 Joel Becker 2008-02-01 3750 * calls dlm_lock(), our cancel will do nothing. We will
de551246e7bc555 Joel Becker 2008-02-01 3751 * get no ast, and we will have no way of knowing the
de551246e7bc555 Joel Becker 2008-02-01 3752 * cancel failed. Meanwhile, the other thread will call
de551246e7bc555 Joel Becker 2008-02-01 3753 * into dlm_lock() and wait...forever.
de551246e7bc555 Joel Becker 2008-02-01 3754 *
de551246e7bc555 Joel Becker 2008-02-01 3755 * Why forever? Because another node has asked for the
de551246e7bc555 Joel Becker 2008-02-01 3756 * lock first; that's why we're here in unblock_lock().
de551246e7bc555 Joel Becker 2008-02-01 3757 *
de551246e7bc555 Joel Becker 2008-02-01 3758 * The solution is OCFS2_LOCK_PENDING. When PENDING is
de551246e7bc555 Joel Becker 2008-02-01 3759 * set, we just requeue the unblock. Only when the other
de551246e7bc555 Joel Becker 2008-02-01 3760 * thread has called dlm_lock() and cleared PENDING will
de551246e7bc555 Joel Becker 2008-02-01 3761 * we then cancel their request.
de551246e7bc555 Joel Becker 2008-02-01 3762 *
de551246e7bc555 Joel Becker 2008-02-01 3763 * All callers of dlm_lock() must set OCFS2_DLM_PENDING
de551246e7bc555 Joel Becker 2008-02-01 3764 * at the same time they set OCFS2_DLM_BUSY. They must
de551246e7bc555 Joel Becker 2008-02-01 3765 * clear OCFS2_DLM_PENDING after dlm_lock() returns.
de551246e7bc555 Joel Becker 2008-02-01 3766 */
9b915181af0a99f Sunil Mushran 2010-02-26 3767 if (lockres->l_flags & OCFS2_LOCK_PENDING) {
9b915181af0a99f Sunil Mushran 2010-02-26 3768 mlog(ML_BASTS, "lockres %s, ReQ: Pending\n",
9b915181af0a99f Sunil Mushran 2010-02-26 3769 lockres->l_name);
de551246e7bc555 Joel Becker 2008-02-01 3770 goto leave_requeue;
9b915181af0a99f Sunil Mushran 2010-02-26 3771 }
de551246e7bc555 Joel Becker 2008-02-01 3772
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3773 ctl->requeue = 1;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3774 ret = ocfs2_prepare_cancel_convert(osb, lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3775 spin_unlock_irqrestore(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3776 if (ret) {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3777 ret = ocfs2_cancel_convert(osb, lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3778 if (ret < 0)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3779 mlog_errno(ret);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3780 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3781 goto leave;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3782 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3783
a19128260107f95 Sunil Mushran 2010-01-21 3784 /*
a19128260107f95 Sunil Mushran 2010-01-21 3785 * This prevents livelocks. OCFS2_LOCK_UPCONVERT_FINISHING flag is
a19128260107f95 Sunil Mushran 2010-01-21 3786 * set when the ast is received for an upconvert just before the
a19128260107f95 Sunil Mushran 2010-01-21 3787 * OCFS2_LOCK_BUSY flag is cleared. Now if the fs received a bast
a19128260107f95 Sunil Mushran 2010-01-21 3788 * on the heels of the ast, we want to delay the downconvert just
a19128260107f95 Sunil Mushran 2010-01-21 3789 * enough to allow the up requestor to do its task. Because this
a19128260107f95 Sunil Mushran 2010-01-21 3790 * lock is in the blocked queue, the lock will be downconverted
a19128260107f95 Sunil Mushran 2010-01-21 3791 * as soon as the requestor is done with the lock.
a19128260107f95 Sunil Mushran 2010-01-21 3792 */
a19128260107f95 Sunil Mushran 2010-01-21 3793 if (lockres->l_flags & OCFS2_LOCK_UPCONVERT_FINISHING)
a19128260107f95 Sunil Mushran 2010-01-21 3794 goto leave_requeue;
a19128260107f95 Sunil Mushran 2010-01-21 3795
0d74125a6a68d4f Sunil Mushran 2010-01-29 3796 /*
0d74125a6a68d4f Sunil Mushran 2010-01-29 3797 * How can we block and yet be at NL? We were trying to upconvert
0d74125a6a68d4f Sunil Mushran 2010-01-29 3798 * from NL and got canceled. The code comes back here, and now
0d74125a6a68d4f Sunil Mushran 2010-01-29 3799 * we notice and clear BLOCKING.
0d74125a6a68d4f Sunil Mushran 2010-01-29 3800 */
0d74125a6a68d4f Sunil Mushran 2010-01-29 3801 if (lockres->l_level == DLM_LOCK_NL) {
0d74125a6a68d4f Sunil Mushran 2010-01-29 3802 BUG_ON(lockres->l_ex_holders || lockres->l_ro_holders);
9b915181af0a99f Sunil Mushran 2010-02-26 3803 mlog(ML_BASTS, "lockres %s, Aborting dc\n", lockres->l_name);
0d74125a6a68d4f Sunil Mushran 2010-01-29 3804 lockres->l_blocking = DLM_LOCK_NL;
0d74125a6a68d4f Sunil Mushran 2010-01-29 3805 lockres_clear_flags(lockres, OCFS2_LOCK_BLOCKED);
0d74125a6a68d4f Sunil Mushran 2010-01-29 3806 spin_unlock_irqrestore(&lockres->l_lock, flags);
0d74125a6a68d4f Sunil Mushran 2010-01-29 3807 goto leave;
0d74125a6a68d4f Sunil Mushran 2010-01-29 3808 }
0d74125a6a68d4f Sunil Mushran 2010-01-29 3809
ccd979bdbce9fba Mark Fasheh 2005-12-15 3810 /* if we're blocking an exclusive and we have *any* holders,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3811 * then requeue. */
bd3e76105d4478a Joel Becker 2008-02-01 3812 if ((lockres->l_blocking == DLM_LOCK_EX)
9b915181af0a99f Sunil Mushran 2010-02-26 3813 && (lockres->l_ex_holders || lockres->l_ro_holders)) {
9b915181af0a99f Sunil Mushran 2010-02-26 3814 mlog(ML_BASTS, "lockres %s, ReQ: EX/PR Holders %u,%u\n",
9b915181af0a99f Sunil Mushran 2010-02-26 3815 lockres->l_name, lockres->l_ex_holders,
9b915181af0a99f Sunil Mushran 2010-02-26 3816 lockres->l_ro_holders);
f7fbfdd1fc91543 Mark Fasheh 2006-09-13 3817 goto leave_requeue;
9b915181af0a99f Sunil Mushran 2010-02-26 3818 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3819
ccd979bdbce9fba Mark Fasheh 2005-12-15 3820 /* If it's a PR we're blocking, then only
ccd979bdbce9fba Mark Fasheh 2005-12-15 3821 * requeue if we've got any EX holders */
bd3e76105d4478a Joel Becker 2008-02-01 3822 if (lockres->l_blocking == DLM_LOCK_PR &&
9b915181af0a99f Sunil Mushran 2010-02-26 3823 lockres->l_ex_holders) {
9b915181af0a99f Sunil Mushran 2010-02-26 3824 mlog(ML_BASTS, "lockres %s, ReQ: EX Holders %u\n",
9b915181af0a99f Sunil Mushran 2010-02-26 3825 lockres->l_name, lockres->l_ex_holders);
f7fbfdd1fc91543 Mark Fasheh 2006-09-13 3826 goto leave_requeue;
9b915181af0a99f Sunil Mushran 2010-02-26 3827 }
f7fbfdd1fc91543 Mark Fasheh 2006-09-13 3828
f7fbfdd1fc91543 Mark Fasheh 2006-09-13 3829 /*
f7fbfdd1fc91543 Mark Fasheh 2006-09-13 3830 * Can we get a lock in this state if the holder counts are
f7fbfdd1fc91543 Mark Fasheh 2006-09-13 3831 * zero? The meta data unblock code used to check this.
f7fbfdd1fc91543 Mark Fasheh 2006-09-13 3832 */
f7fbfdd1fc91543 Mark Fasheh 2006-09-13 3833 if ((lockres->l_ops->flags & LOCK_TYPE_REQUIRES_REFRESH)
9b915181af0a99f Sunil Mushran 2010-02-26 3834 && (lockres->l_flags & OCFS2_LOCK_REFRESHING)) {
9b915181af0a99f Sunil Mushran 2010-02-26 3835 mlog(ML_BASTS, "lockres %s, ReQ: Lock Refreshing\n",
9b915181af0a99f Sunil Mushran 2010-02-26 3836 lockres->l_name);
f7fbfdd1fc91543 Mark Fasheh 2006-09-13 3837 goto leave_requeue;
9b915181af0a99f Sunil Mushran 2010-02-26 3838 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3839
16d5b9567ad5241 Mark Fasheh 2006-09-13 3840 new_level = ocfs2_highest_compat_lock_level(lockres->l_blocking);
16d5b9567ad5241 Mark Fasheh 2006-09-13 3841
16d5b9567ad5241 Mark Fasheh 2006-09-13 3842 if (lockres->l_ops->check_downconvert
9b915181af0a99f Sunil Mushran 2010-02-26 3843 && !lockres->l_ops->check_downconvert(lockres, new_level)) {
9b915181af0a99f Sunil Mushran 2010-02-26 3844 mlog(ML_BASTS, "lockres %s, ReQ: Checkpointing\n",
9b915181af0a99f Sunil Mushran 2010-02-26 3845 lockres->l_name);
16d5b9567ad5241 Mark Fasheh 2006-09-13 3846 goto leave_requeue;
9b915181af0a99f Sunil Mushran 2010-02-26 3847 }
16d5b9567ad5241 Mark Fasheh 2006-09-13 3848
ccd979bdbce9fba Mark Fasheh 2005-12-15 3849 /* If we get here, then we know that there are no more
ccd979bdbce9fba Mark Fasheh 2005-12-15 3850 * incompatible holders (and anyone asking for an incompatible
ccd979bdbce9fba Mark Fasheh 2005-12-15 3851 * lock is blocked). We can now downconvert the lock */
cc567d89b3af429 Mark Fasheh 2006-09-13 3852 if (!lockres->l_ops->downconvert_worker)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3853 goto downconvert;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3854
ccd979bdbce9fba Mark Fasheh 2005-12-15 3855 /* Some lockres types want to do a bit of work before
ccd979bdbce9fba Mark Fasheh 2005-12-15 3856 * downconverting a lock. Allow that here. The worker function
ccd979bdbce9fba Mark Fasheh 2005-12-15 3857 * may sleep, so we save off a copy of what we're blocking as
ccd979bdbce9fba Mark Fasheh 2005-12-15 3858 * it may change while we're not holding the spin lock. */
ccd979bdbce9fba Mark Fasheh 2005-12-15 3859 blocking = lockres->l_blocking;
079b805782f94f4 Sunil Mushran 2010-02-03 3860 level = lockres->l_level;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3861 spin_unlock_irqrestore(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3862
cc567d89b3af429 Mark Fasheh 2006-09-13 3863 ctl->unblock_action = lockres->l_ops->downconvert_worker(lockres, blocking);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3864
9b915181af0a99f Sunil Mushran 2010-02-26 3865 if (ctl->unblock_action == UNBLOCK_STOP_POST) {
9b915181af0a99f Sunil Mushran 2010-02-26 3866 mlog(ML_BASTS, "lockres %s, UNBLOCK_STOP_POST\n",
9b915181af0a99f Sunil Mushran 2010-02-26 3867 lockres->l_name);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3868 goto leave;
9b915181af0a99f Sunil Mushran 2010-02-26 3869 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3870
ccd979bdbce9fba Mark Fasheh 2005-12-15 3871 spin_lock_irqsave(&lockres->l_lock, flags);
079b805782f94f4 Sunil Mushran 2010-02-03 3872 if ((blocking != lockres->l_blocking) || (level != lockres->l_level)) {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3873 /* If this changed underneath us, then we can't drop
ccd979bdbce9fba Mark Fasheh 2005-12-15 3874 * it just yet. */
9b915181af0a99f Sunil Mushran 2010-02-26 3875 mlog(ML_BASTS, "lockres %s, block=%d:%d, level=%d:%d, "
9b915181af0a99f Sunil Mushran 2010-02-26 3876 "Recheck\n", lockres->l_name, blocking,
9b915181af0a99f Sunil Mushran 2010-02-26 3877 lockres->l_blocking, level, lockres->l_level);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3878 goto recheck;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3879 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3880
ccd979bdbce9fba Mark Fasheh 2005-12-15 3881 downconvert:
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3882 ctl->requeue = 0;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3883
5ef0d4ea0877409 Mark Fasheh 2006-09-13 3884 if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB) {
bd3e76105d4478a Joel Becker 2008-02-01 3885 if (lockres->l_level == DLM_LOCK_EX)
5ef0d4ea0877409 Mark Fasheh 2006-09-13 3886 set_lvb = 1;
5ef0d4ea0877409 Mark Fasheh 2006-09-13 3887
5ef0d4ea0877409 Mark Fasheh 2006-09-13 3888 /*
5ef0d4ea0877409 Mark Fasheh 2006-09-13 3889 * We only set the lvb if the lock has been fully
5ef0d4ea0877409 Mark Fasheh 2006-09-13 3890 * refreshed - otherwise we risk setting stale
5ef0d4ea0877409 Mark Fasheh 2006-09-13 3891 * data. Otherwise, there's no need to actually clear
5ef0d4ea0877409 Mark Fasheh 2006-09-13 3892 * out the lvb here as it's value is still valid.
5ef0d4ea0877409 Mark Fasheh 2006-09-13 3893 */
5ef0d4ea0877409 Mark Fasheh 2006-09-13 3894 if (set_lvb && !(lockres->l_flags & OCFS2_LOCK_NEEDS_REFRESH))
5ef0d4ea0877409 Mark Fasheh 2006-09-13 3895 lockres->l_ops->set_lvb(lockres);
5ef0d4ea0877409 Mark Fasheh 2006-09-13 3896 }
5ef0d4ea0877409 Mark Fasheh 2006-09-13 3897
de551246e7bc555 Joel Becker 2008-02-01 3898 gen = ocfs2_prepare_downconvert(lockres, new_level);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3899 spin_unlock_irqrestore(&lockres->l_lock, flags);
de551246e7bc555 Joel Becker 2008-02-01 3900 ret = ocfs2_downconvert_lock(osb, lockres, new_level, set_lvb,
de551246e7bc555 Joel Becker 2008-02-01 3901 gen);
de551246e7bc555 Joel Becker 2008-02-01 3902
ccd979bdbce9fba Mark Fasheh 2005-12-15 3903 leave:
c1e8d35ef5ffb39 Tao Ma 2011-03-07 3904 if (ret)
c1e8d35ef5ffb39 Tao Ma 2011-03-07 3905 mlog_errno(ret);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3906 return ret;
f7fbfdd1fc91543 Mark Fasheh 2006-09-13 3907
f7fbfdd1fc91543 Mark Fasheh 2006-09-13 3908 leave_requeue:
f7fbfdd1fc91543 Mark Fasheh 2006-09-13 3909 spin_unlock_irqrestore(&lockres->l_lock, flags);
f7fbfdd1fc91543 Mark Fasheh 2006-09-13 3910 ctl->requeue = 1;
f7fbfdd1fc91543 Mark Fasheh 2006-09-13 3911
f7fbfdd1fc91543 Mark Fasheh 2006-09-13 3912 return 0;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3913 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3914
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3915 static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
ccd979bdbce9fba Mark Fasheh 2005-12-15 3916 int blocking)
ccd979bdbce9fba Mark Fasheh 2005-12-15 3917 {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3918 struct inode *inode;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3919 struct address_space *mapping;
5e98d492406818e Goldwyn Rodrigues 2010-06-28 3920 struct ocfs2_inode_info *oi;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3921
ccd979bdbce9fba Mark Fasheh 2005-12-15 3922 inode = ocfs2_lock_res_inode(lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3923 mapping = inode->i_mapping;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3924
5e98d492406818e Goldwyn Rodrigues 2010-06-28 3925 if (S_ISDIR(inode->i_mode)) {
5e98d492406818e Goldwyn Rodrigues 2010-06-28 3926 oi = OCFS2_I(inode);
5e98d492406818e Goldwyn Rodrigues 2010-06-28 3927 oi->ip_dir_lock_gen++;
5e98d492406818e Goldwyn Rodrigues 2010-06-28 3928 mlog(0, "generation: %u\n", oi->ip_dir_lock_gen);
5e98d492406818e Goldwyn Rodrigues 2010-06-28 3929 goto out;
5e98d492406818e Goldwyn Rodrigues 2010-06-28 3930 }
5e98d492406818e Goldwyn Rodrigues 2010-06-28 3931
1044e401af9a309 Mark Fasheh 2008-02-28 3932 if (!S_ISREG(inode->i_mode))
f1f540688eae66c Mark Fasheh 2007-10-18 3933 goto out;
f1f540688eae66c Mark Fasheh 2007-10-18 3934
7f4a2a97e324e8c Mark Fasheh 2006-12-11 3935 /*
7f4a2a97e324e8c Mark Fasheh 2006-12-11 3936 * We need this before the filemap_fdatawrite() so that it can
7f4a2a97e324e8c Mark Fasheh 2006-12-11 3937 * transfer the dirty bit from the PTE to the
7f4a2a97e324e8c Mark Fasheh 2006-12-11 3938 * page. Unfortunately this means that even for EX->PR
7f4a2a97e324e8c Mark Fasheh 2006-12-11 3939 * downconverts, we'll lose our mappings and have to build
7f4a2a97e324e8c Mark Fasheh 2006-12-11 3940 * them up again.
7f4a2a97e324e8c Mark Fasheh 2006-12-11 3941 */
7f4a2a97e324e8c Mark Fasheh 2006-12-11 3942 unmap_mapping_range(mapping, 0, 0, 0);
7f4a2a97e324e8c Mark Fasheh 2006-12-11 3943
ccd979bdbce9fba Mark Fasheh 2005-12-15 3944 if (filemap_fdatawrite(mapping)) {
b0697053f9e8de9 Mark Fasheh 2006-03-03 3945 mlog(ML_ERROR, "Could not sync inode %llu for downconvert!",
b0697053f9e8de9 Mark Fasheh 2006-03-03 3946 (unsigned long long)OCFS2_I(inode)->ip_blkno);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3947 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3948 sync_mapping_buffers(mapping);
bd3e76105d4478a Joel Becker 2008-02-01 3949 if (blocking == DLM_LOCK_EX) {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3950 truncate_inode_pages(mapping, 0);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3951 } else {
ccd979bdbce9fba Mark Fasheh 2005-12-15 3952 /* We only need to wait on the I/O if we're not also
ccd979bdbce9fba Mark Fasheh 2005-12-15 3953 * truncating pages because truncate_inode_pages waits
ccd979bdbce9fba Mark Fasheh 2005-12-15 3954 * for us above. We don't truncate pages if we're
ccd979bdbce9fba Mark Fasheh 2005-12-15 3955 * blocking anything < EXMODE because we want to keep
ccd979bdbce9fba Mark Fasheh 2005-12-15 3956 * them around in that case. */
ccd979bdbce9fba Mark Fasheh 2005-12-15 3957 filemap_fdatawait(mapping);
ccd979bdbce9fba Mark Fasheh 2005-12-15 3958 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3959
b8a7a3a6674725d Andreas Gruenbacher 2016-03-24 3960 forget_all_cached_acls(inode);
b8a7a3a6674725d Andreas Gruenbacher 2016-03-24 3961
f1f540688eae66c Mark Fasheh 2007-10-18 3962 out:
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3963 return UNBLOCK_CONTINUE;
ccd979bdbce9fba Mark Fasheh 2005-12-15 3964 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 3965
a433848132d8cdf Tao Ma 2009-08-18 3966 static int ocfs2_ci_checkpointed(struct ocfs2_caching_info *ci,
a433848132d8cdf Tao Ma 2009-08-18 3967 struct ocfs2_lock_res *lockres,
810d5aeba18825c Mark Fasheh 2006-09-13 3968 int new_level)
810d5aeba18825c Mark Fasheh 2006-09-13 3969 {
a433848132d8cdf Tao Ma 2009-08-18 3970 int checkpointed = ocfs2_ci_fully_checkpointed(ci);
810d5aeba18825c Mark Fasheh 2006-09-13 3971
bd3e76105d4478a Joel Becker 2008-02-01 3972 BUG_ON(new_level != DLM_LOCK_NL && new_level != DLM_LOCK_PR);
bd3e76105d4478a Joel Becker 2008-02-01 3973 BUG_ON(lockres->l_level != DLM_LOCK_EX && !checkpointed);
810d5aeba18825c Mark Fasheh 2006-09-13 3974
810d5aeba18825c Mark Fasheh 2006-09-13 3975 if (checkpointed)
810d5aeba18825c Mark Fasheh 2006-09-13 3976 return 1;
810d5aeba18825c Mark Fasheh 2006-09-13 3977
a433848132d8cdf Tao Ma 2009-08-18 3978 ocfs2_start_checkpoint(OCFS2_SB(ocfs2_metadata_cache_get_super(ci)));
810d5aeba18825c Mark Fasheh 2006-09-13 3979 return 0;
810d5aeba18825c Mark Fasheh 2006-09-13 3980 }
810d5aeba18825c Mark Fasheh 2006-09-13 3981
a433848132d8cdf Tao Ma 2009-08-18 3982 static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres,
a433848132d8cdf Tao Ma 2009-08-18 3983 int new_level)
a433848132d8cdf Tao Ma 2009-08-18 3984 {
a433848132d8cdf Tao Ma 2009-08-18 3985 struct inode *inode = ocfs2_lock_res_inode(lockres);
a433848132d8cdf Tao Ma 2009-08-18 3986
a433848132d8cdf Tao Ma 2009-08-18 3987 return ocfs2_ci_checkpointed(INODE_CACHE(inode), lockres, new_level);
a433848132d8cdf Tao Ma 2009-08-18 3988 }
a433848132d8cdf Tao Ma 2009-08-18 3989
810d5aeba18825c Mark Fasheh 2006-09-13 3990 static void ocfs2_set_meta_lvb(struct ocfs2_lock_res *lockres)
810d5aeba18825c Mark Fasheh 2006-09-13 3991 {
810d5aeba18825c Mark Fasheh 2006-09-13 3992 struct inode *inode = ocfs2_lock_res_inode(lockres);
810d5aeba18825c Mark Fasheh 2006-09-13 3993
810d5aeba18825c Mark Fasheh 2006-09-13 3994 __ocfs2_stuff_meta_lvb(inode);
810d5aeba18825c Mark Fasheh 2006-09-13 3995 }
810d5aeba18825c Mark Fasheh 2006-09-13 3996
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3997 /*
d680efe9d8fe0eb Mark Fasheh 2006-09-08 3998 * Does the final reference drop on our dentry lock. Right now this
34d024f84345807 Mark Fasheh 2007-09-24 3999 * happens in the downconvert thread, but we could choose to simplify the
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4000 * dlmglue API and push these off to the ocfs2_wq in the future.
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4001 */
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4002 static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb,
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4003 struct ocfs2_lock_res *lockres)
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4004 {
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4005 struct ocfs2_dentry_lock *dl = ocfs2_lock_res_dl(lockres);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4006 ocfs2_dentry_lock_put(osb, dl);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4007 }
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4008
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4009 /*
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4010 * d_delete() matching dentries before the lock downconvert.
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4011 *
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4012 * At this point, any process waiting to destroy the
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4013 * dentry_lock due to last ref count is stopped by the
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4014 * OCFS2_LOCK_QUEUED flag.
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4015 *
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4016 * We have two potential problems
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4017 *
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4018 * 1) If we do the last reference drop on our dentry_lock (via dput)
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4019 * we'll wind up in ocfs2_release_dentry_lock(), waiting on
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4020 * the downconvert to finish. Instead we take an elevated
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4021 * reference and push the drop until after we've completed our
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4022 * unblock processing.
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4023 *
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4024 * 2) There might be another process with a final reference,
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4025 * waiting on us to finish processing. If this is the case, we
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4026 * detect it and exit out - there's no more dentries anyway.
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4027 */
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4028 static int ocfs2_dentry_convert_worker(struct ocfs2_lock_res *lockres,
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4029 int blocking)
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4030 {
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4031 struct ocfs2_dentry_lock *dl = ocfs2_lock_res_dl(lockres);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4032 struct ocfs2_inode_info *oi = OCFS2_I(dl->dl_inode);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4033 struct dentry *dentry;
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4034 unsigned long flags;
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4035 int extra_ref = 0;
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4036
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4037 /*
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4038 * This node is blocking another node from getting a read
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4039 * lock. This happens when we've renamed within a
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4040 * directory. We've forced the other nodes to d_delete(), but
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4041 * we never actually dropped our lock because it's still
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4042 * valid. The downconvert code will retain a PR for this node,
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4043 * so there's no further work to do.
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4044 */
bd3e76105d4478a Joel Becker 2008-02-01 4045 if (blocking == DLM_LOCK_PR)
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4046 return UNBLOCK_CONTINUE;
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4047
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4048 /*
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4049 * Mark this inode as potentially orphaned. The code in
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4050 * ocfs2_delete_inode() will figure out whether it actually
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4051 * needs to be freed or not.
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4052 */
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4053 spin_lock(&oi->ip_lock);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4054 oi->ip_flags |= OCFS2_INODE_MAYBE_ORPHANED;
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4055 spin_unlock(&oi->ip_lock);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4056
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4057 /*
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4058 * Yuck. We need to make sure however that the check of
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4059 * OCFS2_LOCK_FREEING and the extra reference are atomic with
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4060 * respect to a reference decrement or the setting of that
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4061 * flag.
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4062 */
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4063 spin_lock_irqsave(&lockres->l_lock, flags);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4064 spin_lock(&dentry_attach_lock);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4065 if (!(lockres->l_flags & OCFS2_LOCK_FREEING)
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4066 && dl->dl_count) {
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4067 dl->dl_count++;
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4068 extra_ref = 1;
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4069 }
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4070 spin_unlock(&dentry_attach_lock);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4071 spin_unlock_irqrestore(&lockres->l_lock, flags);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4072
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4073 mlog(0, "extra_ref = %d\n", extra_ref);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4074
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4075 /*
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4076 * We have a process waiting on us in ocfs2_dentry_iput(),
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4077 * which means we can't have any more outstanding
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4078 * aliases. There's no need to do any more work.
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4079 */
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4080 if (!extra_ref)
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4081 return UNBLOCK_CONTINUE;
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4082
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4083 spin_lock(&dentry_attach_lock);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4084 while (1) {
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4085 dentry = ocfs2_find_local_alias(dl->dl_inode,
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4086 dl->dl_parent_blkno, 1);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4087 if (!dentry)
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4088 break;
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4089 spin_unlock(&dentry_attach_lock);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4090
10ab88117d069a5 alex chen 2015-02-10 4091 if (S_ISDIR(dl->dl_inode->i_mode))
10ab88117d069a5 alex chen 2015-02-10 4092 shrink_dcache_parent(dentry);
10ab88117d069a5 alex chen 2015-02-10 4093
a455589f181e604 Al Viro 2014-10-21 4094 mlog(0, "d_delete(%pd);\n", dentry);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4095
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4096 /*
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4097 * The following dcache calls may do an
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4098 * iput(). Normally we don't want that from the
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4099 * downconverting thread, but in this case it's ok
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4100 * because the requesting node already has an
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4101 * exclusive lock on the inode, so it can't be queued
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4102 * for a downconvert.
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4103 */
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4104 d_delete(dentry);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4105 dput(dentry);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4106
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4107 spin_lock(&dentry_attach_lock);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4108 }
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4109 spin_unlock(&dentry_attach_lock);
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4110
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4111 /*
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4112 * If we are the last holder of this dentry lock, there is no
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4113 * reason to downconvert so skip straight to the unlock.
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4114 */
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4115 if (dl->dl_count == 1)
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4116 return UNBLOCK_STOP_POST;
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4117
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4118 return UNBLOCK_CONTINUE_POST;
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4119 }
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4120
8dec98edfe9684c Tao Ma 2009-08-18 4121 static int ocfs2_check_refcount_downconvert(struct ocfs2_lock_res *lockres,
8dec98edfe9684c Tao Ma 2009-08-18 4122 int new_level)
8dec98edfe9684c Tao Ma 2009-08-18 4123 {
8dec98edfe9684c Tao Ma 2009-08-18 4124 struct ocfs2_refcount_tree *tree =
8dec98edfe9684c Tao Ma 2009-08-18 4125 ocfs2_lock_res_refcount_tree(lockres);
8dec98edfe9684c Tao Ma 2009-08-18 4126
8dec98edfe9684c Tao Ma 2009-08-18 4127 return ocfs2_ci_checkpointed(&tree->rf_ci, lockres, new_level);
8dec98edfe9684c Tao Ma 2009-08-18 4128 }
8dec98edfe9684c Tao Ma 2009-08-18 4129
8dec98edfe9684c Tao Ma 2009-08-18 4130 static int ocfs2_refcount_convert_worker(struct ocfs2_lock_res *lockres,
8dec98edfe9684c Tao Ma 2009-08-18 4131 int blocking)
8dec98edfe9684c Tao Ma 2009-08-18 4132 {
8dec98edfe9684c Tao Ma 2009-08-18 4133 struct ocfs2_refcount_tree *tree =
8dec98edfe9684c Tao Ma 2009-08-18 4134 ocfs2_lock_res_refcount_tree(lockres);
8dec98edfe9684c Tao Ma 2009-08-18 4135
8dec98edfe9684c Tao Ma 2009-08-18 4136 ocfs2_metadata_cache_purge(&tree->rf_ci);
8dec98edfe9684c Tao Ma 2009-08-18 4137
8dec98edfe9684c Tao Ma 2009-08-18 4138 return UNBLOCK_CONTINUE;
8dec98edfe9684c Tao Ma 2009-08-18 4139 }
8dec98edfe9684c Tao Ma 2009-08-18 4140
9e33d69f553aaf1 Jan Kara 2008-08-25 4141 static void ocfs2_set_qinfo_lvb(struct ocfs2_lock_res *lockres)
9e33d69f553aaf1 Jan Kara 2008-08-25 4142 {
9e33d69f553aaf1 Jan Kara 2008-08-25 4143 struct ocfs2_qinfo_lvb *lvb;
9e33d69f553aaf1 Jan Kara 2008-08-25 4144 struct ocfs2_mem_dqinfo *oinfo = ocfs2_lock_res_qinfo(lockres);
9e33d69f553aaf1 Jan Kara 2008-08-25 4145 struct mem_dqinfo *info = sb_dqinfo(oinfo->dqi_gi.dqi_sb,
9e33d69f553aaf1 Jan Kara 2008-08-25 4146 oinfo->dqi_gi.dqi_type);
9e33d69f553aaf1 Jan Kara 2008-08-25 4147
a641dc2a5a1445e Mark Fasheh 2008-12-24 4148 lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
9e33d69f553aaf1 Jan Kara 2008-08-25 4149 lvb->lvb_version = OCFS2_QINFO_LVB_VERSION;
9e33d69f553aaf1 Jan Kara 2008-08-25 4150 lvb->lvb_bgrace = cpu_to_be32(info->dqi_bgrace);
9e33d69f553aaf1 Jan Kara 2008-08-25 4151 lvb->lvb_igrace = cpu_to_be32(info->dqi_igrace);
9e33d69f553aaf1 Jan Kara 2008-08-25 4152 lvb->lvb_syncms = cpu_to_be32(oinfo->dqi_syncms);
9e33d69f553aaf1 Jan Kara 2008-08-25 4153 lvb->lvb_blocks = cpu_to_be32(oinfo->dqi_gi.dqi_blocks);
9e33d69f553aaf1 Jan Kara 2008-08-25 4154 lvb->lvb_free_blk = cpu_to_be32(oinfo->dqi_gi.dqi_free_blk);
9e33d69f553aaf1 Jan Kara 2008-08-25 4155 lvb->lvb_free_entry = cpu_to_be32(oinfo->dqi_gi.dqi_free_entry);
9e33d69f553aaf1 Jan Kara 2008-08-25 4156 }
9e33d69f553aaf1 Jan Kara 2008-08-25 4157
9e33d69f553aaf1 Jan Kara 2008-08-25 4158 void ocfs2_qinfo_unlock(struct ocfs2_mem_dqinfo *oinfo, int ex)
9e33d69f553aaf1 Jan Kara 2008-08-25 4159 {
9e33d69f553aaf1 Jan Kara 2008-08-25 4160 struct ocfs2_lock_res *lockres = &oinfo->dqi_gqlock;
9e33d69f553aaf1 Jan Kara 2008-08-25 4161 struct ocfs2_super *osb = OCFS2_SB(oinfo->dqi_gi.dqi_sb);
9e33d69f553aaf1 Jan Kara 2008-08-25 4162 int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR;
9e33d69f553aaf1 Jan Kara 2008-08-25 4163
9e33d69f553aaf1 Jan Kara 2008-08-25 4164 if (!ocfs2_is_hard_readonly(osb) && !ocfs2_mount_local(osb))
9e33d69f553aaf1 Jan Kara 2008-08-25 4165 ocfs2_cluster_unlock(osb, lockres, level);
9e33d69f553aaf1 Jan Kara 2008-08-25 4166 }
9e33d69f553aaf1 Jan Kara 2008-08-25 4167
9e33d69f553aaf1 Jan Kara 2008-08-25 4168 static int ocfs2_refresh_qinfo(struct ocfs2_mem_dqinfo *oinfo)
9e33d69f553aaf1 Jan Kara 2008-08-25 4169 {
9e33d69f553aaf1 Jan Kara 2008-08-25 4170 struct mem_dqinfo *info = sb_dqinfo(oinfo->dqi_gi.dqi_sb,
9e33d69f553aaf1 Jan Kara 2008-08-25 4171 oinfo->dqi_gi.dqi_type);
9e33d69f553aaf1 Jan Kara 2008-08-25 4172 struct ocfs2_lock_res *lockres = &oinfo->dqi_gqlock;
9e33d69f553aaf1 Jan Kara 2008-08-25 4173 struct ocfs2_qinfo_lvb *lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
85eb8b73d66530b Joel Becker 2008-11-25 4174 struct buffer_head *bh = NULL;
9e33d69f553aaf1 Jan Kara 2008-08-25 4175 struct ocfs2_global_disk_dqinfo *gdinfo;
9e33d69f553aaf1 Jan Kara 2008-08-25 4176 int status = 0;
9e33d69f553aaf1 Jan Kara 2008-08-25 4177
1c520dfbf391e16 Joel Becker 2009-06-19 4178 if (ocfs2_dlm_lvb_valid(&lockres->l_lksb) &&
1c520dfbf391e16 Joel Becker 2009-06-19 4179 lvb->lvb_version == OCFS2_QINFO_LVB_VERSION) {
9e33d69f553aaf1 Jan Kara 2008-08-25 4180 info->dqi_bgrace = be32_to_cpu(lvb->lvb_bgrace);
9e33d69f553aaf1 Jan Kara 2008-08-25 4181 info->dqi_igrace = be32_to_cpu(lvb->lvb_igrace);
9e33d69f553aaf1 Jan Kara 2008-08-25 4182 oinfo->dqi_syncms = be32_to_cpu(lvb->lvb_syncms);
9e33d69f553aaf1 Jan Kara 2008-08-25 4183 oinfo->dqi_gi.dqi_blocks = be32_to_cpu(lvb->lvb_blocks);
9e33d69f553aaf1 Jan Kara 2008-08-25 4184 oinfo->dqi_gi.dqi_free_blk = be32_to_cpu(lvb->lvb_free_blk);
9e33d69f553aaf1 Jan Kara 2008-08-25 4185 oinfo->dqi_gi.dqi_free_entry =
9e33d69f553aaf1 Jan Kara 2008-08-25 4186 be32_to_cpu(lvb->lvb_free_entry);
9e33d69f553aaf1 Jan Kara 2008-08-25 4187 } else {
ae4f6ef13417dea Jan Kara 2010-04-28 4188 status = ocfs2_read_quota_phys_block(oinfo->dqi_gqinode,
ae4f6ef13417dea Jan Kara 2010-04-28 4189 oinfo->dqi_giblk, &bh);
85eb8b73d66530b Joel Becker 2008-11-25 4190 if (status) {
9e33d69f553aaf1 Jan Kara 2008-08-25 4191 mlog_errno(status);
9e33d69f553aaf1 Jan Kara 2008-08-25 4192 goto bail;
9e33d69f553aaf1 Jan Kara 2008-08-25 4193 }
9e33d69f553aaf1 Jan Kara 2008-08-25 4194 gdinfo = (struct ocfs2_global_disk_dqinfo *)
9e33d69f553aaf1 Jan Kara 2008-08-25 4195 (bh->b_data + OCFS2_GLOBAL_INFO_OFF);
9e33d69f553aaf1 Jan Kara 2008-08-25 4196 info->dqi_bgrace = le32_to_cpu(gdinfo->dqi_bgrace);
9e33d69f553aaf1 Jan Kara 2008-08-25 4197 info->dqi_igrace = le32_to_cpu(gdinfo->dqi_igrace);
9e33d69f553aaf1 Jan Kara 2008-08-25 4198 oinfo->dqi_syncms = le32_to_cpu(gdinfo->dqi_syncms);
9e33d69f553aaf1 Jan Kara 2008-08-25 4199 oinfo->dqi_gi.dqi_blocks = le32_to_cpu(gdinfo->dqi_blocks);
9e33d69f553aaf1 Jan Kara 2008-08-25 4200 oinfo->dqi_gi.dqi_free_blk = le32_to_cpu(gdinfo->dqi_free_blk);
9e33d69f553aaf1 Jan Kara 2008-08-25 4201 oinfo->dqi_gi.dqi_free_entry =
9e33d69f553aaf1 Jan Kara 2008-08-25 4202 le32_to_cpu(gdinfo->dqi_free_entry);
9e33d69f553aaf1 Jan Kara 2008-08-25 4203 brelse(bh);
9e33d69f553aaf1 Jan Kara 2008-08-25 4204 ocfs2_track_lock_refresh(lockres);
9e33d69f553aaf1 Jan Kara 2008-08-25 4205 }
9e33d69f553aaf1 Jan Kara 2008-08-25 4206
9e33d69f553aaf1 Jan Kara 2008-08-25 4207 bail:
9e33d69f553aaf1 Jan Kara 2008-08-25 4208 return status;
9e33d69f553aaf1 Jan Kara 2008-08-25 4209 }
9e33d69f553aaf1 Jan Kara 2008-08-25 4210
9e33d69f553aaf1 Jan Kara 2008-08-25 4211 /* Lock quota info, this function expects at least shared lock on the quota file
9e33d69f553aaf1 Jan Kara 2008-08-25 4212 * so that we can safely refresh quota info from disk. */
9e33d69f553aaf1 Jan Kara 2008-08-25 4213 int ocfs2_qinfo_lock(struct ocfs2_mem_dqinfo *oinfo, int ex)
9e33d69f553aaf1 Jan Kara 2008-08-25 4214 {
9e33d69f553aaf1 Jan Kara 2008-08-25 4215 struct ocfs2_lock_res *lockres = &oinfo->dqi_gqlock;
9e33d69f553aaf1 Jan Kara 2008-08-25 4216 struct ocfs2_super *osb = OCFS2_SB(oinfo->dqi_gi.dqi_sb);
9e33d69f553aaf1 Jan Kara 2008-08-25 4217 int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR;
9e33d69f553aaf1 Jan Kara 2008-08-25 4218 int status = 0;
9e33d69f553aaf1 Jan Kara 2008-08-25 4219
9e33d69f553aaf1 Jan Kara 2008-08-25 4220 /* On RO devices, locking really isn't needed... */
9e33d69f553aaf1 Jan Kara 2008-08-25 4221 if (ocfs2_is_hard_readonly(osb)) {
9e33d69f553aaf1 Jan Kara 2008-08-25 4222 if (ex)
9e33d69f553aaf1 Jan Kara 2008-08-25 4223 status = -EROFS;
9e33d69f553aaf1 Jan Kara 2008-08-25 4224 goto bail;
9e33d69f553aaf1 Jan Kara 2008-08-25 4225 }
9e33d69f553aaf1 Jan Kara 2008-08-25 4226 if (ocfs2_mount_local(osb))
9e33d69f553aaf1 Jan Kara 2008-08-25 4227 goto bail;
9e33d69f553aaf1 Jan Kara 2008-08-25 4228
9e33d69f553aaf1 Jan Kara 2008-08-25 4229 status = ocfs2_cluster_lock(osb, lockres, level, 0, 0);
9e33d69f553aaf1 Jan Kara 2008-08-25 4230 if (status < 0) {
9e33d69f553aaf1 Jan Kara 2008-08-25 4231 mlog_errno(status);
9e33d69f553aaf1 Jan Kara 2008-08-25 4232 goto bail;
9e33d69f553aaf1 Jan Kara 2008-08-25 4233 }
9e33d69f553aaf1 Jan Kara 2008-08-25 4234 if (!ocfs2_should_refresh_lock_res(lockres))
9e33d69f553aaf1 Jan Kara 2008-08-25 4235 goto bail;
9e33d69f553aaf1 Jan Kara 2008-08-25 4236 /* OK, we have the lock but we need to refresh the quota info */
9e33d69f553aaf1 Jan Kara 2008-08-25 4237 status = ocfs2_refresh_qinfo(oinfo);
9e33d69f553aaf1 Jan Kara 2008-08-25 4238 if (status)
9e33d69f553aaf1 Jan Kara 2008-08-25 4239 ocfs2_qinfo_unlock(oinfo, ex);
9e33d69f553aaf1 Jan Kara 2008-08-25 4240 ocfs2_complete_lock_res_refresh(lockres, status);
9e33d69f553aaf1 Jan Kara 2008-08-25 4241 bail:
9e33d69f553aaf1 Jan Kara 2008-08-25 4242 return status;
9e33d69f553aaf1 Jan Kara 2008-08-25 4243 }
9e33d69f553aaf1 Jan Kara 2008-08-25 4244
8dec98edfe9684c Tao Ma 2009-08-18 4245 int ocfs2_refcount_lock(struct ocfs2_refcount_tree *ref_tree, int ex)
8dec98edfe9684c Tao Ma 2009-08-18 4246 {
8dec98edfe9684c Tao Ma 2009-08-18 4247 int status;
8dec98edfe9684c Tao Ma 2009-08-18 4248 int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR;
8dec98edfe9684c Tao Ma 2009-08-18 4249 struct ocfs2_lock_res *lockres = &ref_tree->rf_lockres;
8dec98edfe9684c Tao Ma 2009-08-18 4250 struct ocfs2_super *osb = lockres->l_priv;
8dec98edfe9684c Tao Ma 2009-08-18 4251
8dec98edfe9684c Tao Ma 2009-08-18 4252
8dec98edfe9684c Tao Ma 2009-08-18 4253 if (ocfs2_is_hard_readonly(osb))
8dec98edfe9684c Tao Ma 2009-08-18 4254 return -EROFS;
8dec98edfe9684c Tao Ma 2009-08-18 4255
8dec98edfe9684c Tao Ma 2009-08-18 4256 if (ocfs2_mount_local(osb))
8dec98edfe9684c Tao Ma 2009-08-18 4257 return 0;
8dec98edfe9684c Tao Ma 2009-08-18 4258
8dec98edfe9684c Tao Ma 2009-08-18 4259 status = ocfs2_cluster_lock(osb, lockres, level, 0, 0);
8dec98edfe9684c Tao Ma 2009-08-18 4260 if (status < 0)
8dec98edfe9684c Tao Ma 2009-08-18 4261 mlog_errno(status);
8dec98edfe9684c Tao Ma 2009-08-18 4262
8dec98edfe9684c Tao Ma 2009-08-18 4263 return status;
8dec98edfe9684c Tao Ma 2009-08-18 4264 }
8dec98edfe9684c Tao Ma 2009-08-18 4265
8dec98edfe9684c Tao Ma 2009-08-18 4266 void ocfs2_refcount_unlock(struct ocfs2_refcount_tree *ref_tree, int ex)
8dec98edfe9684c Tao Ma 2009-08-18 4267 {
8dec98edfe9684c Tao Ma 2009-08-18 4268 int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR;
8dec98edfe9684c Tao Ma 2009-08-18 4269 struct ocfs2_lock_res *lockres = &ref_tree->rf_lockres;
8dec98edfe9684c Tao Ma 2009-08-18 4270 struct ocfs2_super *osb = lockres->l_priv;
8dec98edfe9684c Tao Ma 2009-08-18 4271
8dec98edfe9684c Tao Ma 2009-08-18 4272 if (!ocfs2_mount_local(osb))
8dec98edfe9684c Tao Ma 2009-08-18 4273 ocfs2_cluster_unlock(osb, lockres, level);
8dec98edfe9684c Tao Ma 2009-08-18 4274 }
8dec98edfe9684c Tao Ma 2009-08-18 4275
006000566d4e95b Adrian Bunk 2008-01-29 4276 static void ocfs2_process_blocked_lock(struct ocfs2_super *osb,
ccd979bdbce9fba Mark Fasheh 2005-12-15 4277 struct ocfs2_lock_res *lockres)
ccd979bdbce9fba Mark Fasheh 2005-12-15 4278 {
ccd979bdbce9fba Mark Fasheh 2005-12-15 4279 int status;
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4280 struct ocfs2_unblock_ctl ctl = {0, 0,};
ccd979bdbce9fba Mark Fasheh 2005-12-15 4281 unsigned long flags;
ccd979bdbce9fba Mark Fasheh 2005-12-15 4282
ccd979bdbce9fba Mark Fasheh 2005-12-15 4283 /* Our reference to the lockres in this function can be
ccd979bdbce9fba Mark Fasheh 2005-12-15 4284 * considered valid until we remove the OCFS2_LOCK_QUEUED
ccd979bdbce9fba Mark Fasheh 2005-12-15 4285 * flag. */
ccd979bdbce9fba Mark Fasheh 2005-12-15 4286
ccd979bdbce9fba Mark Fasheh 2005-12-15 4287 BUG_ON(!lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4288 BUG_ON(!lockres->l_ops);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4289
9b915181af0a99f Sunil Mushran 2010-02-26 4290 mlog(ML_BASTS, "lockres %s blocked\n", lockres->l_name);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4291
ccd979bdbce9fba Mark Fasheh 2005-12-15 4292 /* Detect whether a lock has been marked as going away while
34d024f84345807 Mark Fasheh 2007-09-24 4293 * the downconvert thread was processing other things. A lock can
ccd979bdbce9fba Mark Fasheh 2005-12-15 4294 * still be marked with OCFS2_LOCK_FREEING after this check,
ccd979bdbce9fba Mark Fasheh 2005-12-15 4295 * but short circuiting here will still save us some
ccd979bdbce9fba Mark Fasheh 2005-12-15 4296 * performance. */
ccd979bdbce9fba Mark Fasheh 2005-12-15 4297 spin_lock_irqsave(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4298 if (lockres->l_flags & OCFS2_LOCK_FREEING)
ccd979bdbce9fba Mark Fasheh 2005-12-15 4299 goto unqueue;
ccd979bdbce9fba Mark Fasheh 2005-12-15 4300 spin_unlock_irqrestore(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4301
b5e500e23e53279 Mark Fasheh 2006-09-13 4302 status = ocfs2_unblock_lock(osb, lockres, &ctl);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4303 if (status < 0)
ccd979bdbce9fba Mark Fasheh 2005-12-15 4304 mlog_errno(status);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4305
ccd979bdbce9fba Mark Fasheh 2005-12-15 4306 spin_lock_irqsave(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4307 unqueue:
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4308 if (lockres->l_flags & OCFS2_LOCK_FREEING || !ctl.requeue) {
ccd979bdbce9fba Mark Fasheh 2005-12-15 4309 lockres_clear_flags(lockres, OCFS2_LOCK_QUEUED);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4310 } else
ccd979bdbce9fba Mark Fasheh 2005-12-15 4311 ocfs2_schedule_blocked_lock(osb, lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4312
9b915181af0a99f Sunil Mushran 2010-02-26 4313 mlog(ML_BASTS, "lockres %s, requeue = %s.\n", lockres->l_name,
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4314 ctl.requeue ? "yes" : "no");
ccd979bdbce9fba Mark Fasheh 2005-12-15 4315 spin_unlock_irqrestore(&lockres->l_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4316
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4317 if (ctl.unblock_action != UNBLOCK_CONTINUE
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4318 && lockres->l_ops->post_unlock)
d680efe9d8fe0eb Mark Fasheh 2006-09-08 4319 lockres->l_ops->post_unlock(osb, lockres);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4320 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 4321
ccd979bdbce9fba Mark Fasheh 2005-12-15 4322 static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb,
ccd979bdbce9fba Mark Fasheh 2005-12-15 4323 struct ocfs2_lock_res *lockres)
ccd979bdbce9fba Mark Fasheh 2005-12-15 4324 {
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4325 unsigned long flags;
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4326
ccd979bdbce9fba Mark Fasheh 2005-12-15 4327 assert_spin_locked(&lockres->l_lock);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4328
ccd979bdbce9fba Mark Fasheh 2005-12-15 4329 if (lockres->l_flags & OCFS2_LOCK_FREEING) {
ccd979bdbce9fba Mark Fasheh 2005-12-15 4330 /* Do not schedule a lock for downconvert when it's on
ccd979bdbce9fba Mark Fasheh 2005-12-15 4331 * the way to destruction - any nodes wanting access
ccd979bdbce9fba Mark Fasheh 2005-12-15 4332 * to the resource will get it soon. */
9b915181af0a99f Sunil Mushran 2010-02-26 4333 mlog(ML_BASTS, "lockres %s won't be scheduled: flags 0x%lx\n",
ccd979bdbce9fba Mark Fasheh 2005-12-15 4334 lockres->l_name, lockres->l_flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4335 return;
ccd979bdbce9fba Mark Fasheh 2005-12-15 4336 }
ccd979bdbce9fba Mark Fasheh 2005-12-15 4337
ccd979bdbce9fba Mark Fasheh 2005-12-15 4338 lockres_or_flags(lockres, OCFS2_LOCK_QUEUED);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4339
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4340 spin_lock_irqsave(&osb->dc_task_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4341 if (list_empty(&lockres->l_blocked_list)) {
ccd979bdbce9fba Mark Fasheh 2005-12-15 4342 list_add_tail(&lockres->l_blocked_list,
ccd979bdbce9fba Mark Fasheh 2005-12-15 4343 &osb->blocked_lock_list);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4344 osb->blocked_lock_count++;
ccd979bdbce9fba Mark Fasheh 2005-12-15 4345 }
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4346 spin_unlock_irqrestore(&osb->dc_task_lock, flags);
ccd979bdbce9fba Mark Fasheh 2005-12-15 4347 }
34d024f84345807 Mark Fasheh 2007-09-24 4348
34d024f84345807 Mark Fasheh 2007-09-24 4349 static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb)
34d024f84345807 Mark Fasheh 2007-09-24 4350 {
34d024f84345807 Mark Fasheh 2007-09-24 4351 unsigned long processed;
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4352 unsigned long flags;
34d024f84345807 Mark Fasheh 2007-09-24 4353 struct ocfs2_lock_res *lockres;
34d024f84345807 Mark Fasheh 2007-09-24 4354
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4355 spin_lock_irqsave(&osb->dc_task_lock, flags);
34d024f84345807 Mark Fasheh 2007-09-24 4356 /* grab this early so we know to try again if a state change and
34d024f84345807 Mark Fasheh 2007-09-24 4357 * wake happens part-way through our work */
34d024f84345807 Mark Fasheh 2007-09-24 4358 osb->dc_work_sequence = osb->dc_wake_sequence;
34d024f84345807 Mark Fasheh 2007-09-24 4359
34d024f84345807 Mark Fasheh 2007-09-24 4360 processed = osb->blocked_lock_count;
209f7512d007980 Joseph Qi 2015-08-06 4361 /*
209f7512d007980 Joseph Qi 2015-08-06 4362 * blocked lock processing in this loop might call iput which can
209f7512d007980 Joseph Qi 2015-08-06 4363 * remove items off osb->blocked_lock_list. Downconvert up to
209f7512d007980 Joseph Qi 2015-08-06 4364 * 'processed' number of locks, but stop short if we had some
209f7512d007980 Joseph Qi 2015-08-06 4365 * removed in ocfs2_mark_lockres_freeing when downconverting.
209f7512d007980 Joseph Qi 2015-08-06 4366 */
209f7512d007980 Joseph Qi 2015-08-06 4367 while (processed && !list_empty(&osb->blocked_lock_list)) {
34d024f84345807 Mark Fasheh 2007-09-24 4368 lockres = list_entry(osb->blocked_lock_list.next,
34d024f84345807 Mark Fasheh 2007-09-24 4369 struct ocfs2_lock_res, l_blocked_list);
34d024f84345807 Mark Fasheh 2007-09-24 4370 list_del_init(&lockres->l_blocked_list);
34d024f84345807 Mark Fasheh 2007-09-24 4371 osb->blocked_lock_count--;
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4372 spin_unlock_irqrestore(&osb->dc_task_lock, flags);
34d024f84345807 Mark Fasheh 2007-09-24 4373
34d024f84345807 Mark Fasheh 2007-09-24 4374 BUG_ON(!processed);
34d024f84345807 Mark Fasheh 2007-09-24 4375 processed--;
34d024f84345807 Mark Fasheh 2007-09-24 4376
34d024f84345807 Mark Fasheh 2007-09-24 4377 ocfs2_process_blocked_lock(osb, lockres);
34d024f84345807 Mark Fasheh 2007-09-24 4378
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4379 spin_lock_irqsave(&osb->dc_task_lock, flags);
34d024f84345807 Mark Fasheh 2007-09-24 4380 }
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4381 spin_unlock_irqrestore(&osb->dc_task_lock, flags);
34d024f84345807 Mark Fasheh 2007-09-24 4382 }
34d024f84345807 Mark Fasheh 2007-09-24 4383
34d024f84345807 Mark Fasheh 2007-09-24 4384 static int ocfs2_downconvert_thread_lists_empty(struct ocfs2_super *osb)
34d024f84345807 Mark Fasheh 2007-09-24 4385 {
34d024f84345807 Mark Fasheh 2007-09-24 4386 int empty = 0;
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4387 unsigned long flags;
34d024f84345807 Mark Fasheh 2007-09-24 4388
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4389 spin_lock_irqsave(&osb->dc_task_lock, flags);
34d024f84345807 Mark Fasheh 2007-09-24 4390 if (list_empty(&osb->blocked_lock_list))
34d024f84345807 Mark Fasheh 2007-09-24 4391 empty = 1;
34d024f84345807 Mark Fasheh 2007-09-24 4392
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4393 spin_unlock_irqrestore(&osb->dc_task_lock, flags);
34d024f84345807 Mark Fasheh 2007-09-24 4394 return empty;
34d024f84345807 Mark Fasheh 2007-09-24 4395 }
34d024f84345807 Mark Fasheh 2007-09-24 4396
34d024f84345807 Mark Fasheh 2007-09-24 4397 static int ocfs2_downconvert_thread_should_wake(struct ocfs2_super *osb)
34d024f84345807 Mark Fasheh 2007-09-24 4398 {
34d024f84345807 Mark Fasheh 2007-09-24 4399 int should_wake = 0;
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4400 unsigned long flags;
34d024f84345807 Mark Fasheh 2007-09-24 4401
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4402 spin_lock_irqsave(&osb->dc_task_lock, flags);
34d024f84345807 Mark Fasheh 2007-09-24 4403 if (osb->dc_work_sequence != osb->dc_wake_sequence)
34d024f84345807 Mark Fasheh 2007-09-24 4404 should_wake = 1;
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4405 spin_unlock_irqrestore(&osb->dc_task_lock, flags);
34d024f84345807 Mark Fasheh 2007-09-24 4406
34d024f84345807 Mark Fasheh 2007-09-24 4407 return should_wake;
34d024f84345807 Mark Fasheh 2007-09-24 4408 }
34d024f84345807 Mark Fasheh 2007-09-24 4409
200bfae37a15e50 Adrian Bunk 2008-02-17 4410 static int ocfs2_downconvert_thread(void *arg)
34d024f84345807 Mark Fasheh 2007-09-24 4411 {
34d024f84345807 Mark Fasheh 2007-09-24 4412 struct ocfs2_super *osb = arg;
34d024f84345807 Mark Fasheh 2007-09-24 4413
34d024f84345807 Mark Fasheh 2007-09-24 4414 /* only quit once we've been asked to stop and there is no more
34d024f84345807 Mark Fasheh 2007-09-24 4415 * work available */
34d024f84345807 Mark Fasheh 2007-09-24 4416 while (!(kthread_should_stop() &&
34d024f84345807 Mark Fasheh 2007-09-24 4417 ocfs2_downconvert_thread_lists_empty(osb))) {
34d024f84345807 Mark Fasheh 2007-09-24 4418
34d024f84345807 Mark Fasheh 2007-09-24 4419 wait_event_interruptible(osb->dc_event,
34d024f84345807 Mark Fasheh 2007-09-24 4420 ocfs2_downconvert_thread_should_wake(osb) ||
34d024f84345807 Mark Fasheh 2007-09-24 4421 kthread_should_stop());
34d024f84345807 Mark Fasheh 2007-09-24 4422
34d024f84345807 Mark Fasheh 2007-09-24 4423 mlog(0, "downconvert_thread: awoken\n");
34d024f84345807 Mark Fasheh 2007-09-24 4424
34d024f84345807 Mark Fasheh 2007-09-24 4425 ocfs2_downconvert_thread_do_work(osb);
34d024f84345807 Mark Fasheh 2007-09-24 4426 }
34d024f84345807 Mark Fasheh 2007-09-24 4427
34d024f84345807 Mark Fasheh 2007-09-24 4428 osb->dc_task = NULL;
4658d87cb38cb3a Hariprasad Kelam 2019-07-11 4429 return 0;
34d024f84345807 Mark Fasheh 2007-09-24 4430 }
34d024f84345807 Mark Fasheh 2007-09-24 4431
34d024f84345807 Mark Fasheh 2007-09-24 4432 void ocfs2_wake_downconvert_thread(struct ocfs2_super *osb)
34d024f84345807 Mark Fasheh 2007-09-24 4433 {
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4434 unsigned long flags;
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4435
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4436 spin_lock_irqsave(&osb->dc_task_lock, flags);
34d024f84345807 Mark Fasheh 2007-09-24 4437 /* make sure the voting thread gets a swipe at whatever changes
34d024f84345807 Mark Fasheh 2007-09-24 4438 * the caller may have made to the voting state */
34d024f84345807 Mark Fasheh 2007-09-24 4439 osb->dc_wake_sequence++;
a75e9ccabd925d1 Srinivas Eeda 2012-01-30 4440 spin_unlock_irqrestore(&osb->dc_task_lock, flags);
34d024f84345807 Mark Fasheh 2007-09-24 4441 wake_up(&osb->dc_event);
34d024f84345807 Mark Fasheh 2007-09-24 4442 }
:::::: The code at line 3291 was first introduced by commit
:::::: 8056773ac4b42f36bae6406030218a5f12749c64 ocfs2: add locking filter debugfs file
:::::: TO: Gang He <ghe at suse.com>
:::::: CC: Linus Torvalds <torvalds at linux-foundation.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 27711 bytes
Desc: not available
URL: <http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/attachments/20190722/513173ce/attachment-0001.bin>
More information about the devel
mailing list