| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* -*- mode: c; c-basic-offset: 8; -*- |
|---|
| 2 | 3 | * vim: noexpandtab sw=8 ts=8 sts=0: |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * Code which implements an OCFS2 specific interface to our DLM. |
|---|
| 7 | 8 | * |
|---|
| 8 | 9 | * Copyright (C) 2003, 2004 Oracle. All rights reserved. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or |
|---|
| 11 | | - * modify it under the terms of the GNU General Public |
|---|
| 12 | | - * License as published by the Free Software Foundation; either |
|---|
| 13 | | - * version 2 of the License, or (at your option) any later version. |
|---|
| 14 | | - * |
|---|
| 15 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 16 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 17 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 18 | | - * General Public License for more details. |
|---|
| 19 | | - * |
|---|
| 20 | | - * You should have received a copy of the GNU General Public |
|---|
| 21 | | - * License along with this program; if not, write to the |
|---|
| 22 | | - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|---|
| 23 | | - * Boston, MA 021110-1307, USA. |
|---|
| 24 | 10 | */ |
|---|
| 25 | 11 | |
|---|
| 26 | 12 | #include <linux/types.h> |
|---|
| .. | .. |
|---|
| 440 | 426 | static void ocfs2_init_lock_stats(struct ocfs2_lock_res *res) |
|---|
| 441 | 427 | { |
|---|
| 442 | 428 | res->l_lock_refresh = 0; |
|---|
| 429 | + res->l_lock_wait = 0; |
|---|
| 443 | 430 | memset(&res->l_lock_prmode, 0, sizeof(struct ocfs2_lock_stats)); |
|---|
| 444 | 431 | memset(&res->l_lock_exmode, 0, sizeof(struct ocfs2_lock_stats)); |
|---|
| 445 | 432 | } |
|---|
| .. | .. |
|---|
| 474 | 461 | |
|---|
| 475 | 462 | if (ret) |
|---|
| 476 | 463 | stats->ls_fail++; |
|---|
| 464 | + |
|---|
| 465 | + stats->ls_last = ktime_to_us(ktime_get_real()); |
|---|
| 477 | 466 | } |
|---|
| 478 | 467 | |
|---|
| 479 | 468 | static inline void ocfs2_track_lock_refresh(struct ocfs2_lock_res *lockres) |
|---|
| 480 | 469 | { |
|---|
| 481 | 470 | lockres->l_lock_refresh++; |
|---|
| 471 | +} |
|---|
| 472 | + |
|---|
| 473 | +static inline void ocfs2_track_lock_wait(struct ocfs2_lock_res *lockres) |
|---|
| 474 | +{ |
|---|
| 475 | + struct ocfs2_mask_waiter *mw; |
|---|
| 476 | + |
|---|
| 477 | + if (list_empty(&lockres->l_mask_waiters)) { |
|---|
| 478 | + lockres->l_lock_wait = 0; |
|---|
| 479 | + return; |
|---|
| 480 | + } |
|---|
| 481 | + |
|---|
| 482 | + mw = list_first_entry(&lockres->l_mask_waiters, |
|---|
| 483 | + struct ocfs2_mask_waiter, mw_item); |
|---|
| 484 | + lockres->l_lock_wait = |
|---|
| 485 | + ktime_to_us(ktime_mono_to_real(mw->mw_lock_start)); |
|---|
| 482 | 486 | } |
|---|
| 483 | 487 | |
|---|
| 484 | 488 | static inline void ocfs2_init_start_time(struct ocfs2_mask_waiter *mw) |
|---|
| .. | .. |
|---|
| 494 | 498 | { |
|---|
| 495 | 499 | } |
|---|
| 496 | 500 | static inline void ocfs2_track_lock_refresh(struct ocfs2_lock_res *lockres) |
|---|
| 501 | +{ |
|---|
| 502 | +} |
|---|
| 503 | +static inline void ocfs2_track_lock_wait(struct ocfs2_lock_res *lockres) |
|---|
| 497 | 504 | { |
|---|
| 498 | 505 | } |
|---|
| 499 | 506 | static inline void ocfs2_init_start_time(struct ocfs2_mask_waiter *mw) |
|---|
| .. | .. |
|---|
| 563 | 570 | mlog_bug_on_msg(1, "type: %d\n", type); |
|---|
| 564 | 571 | ops = NULL; /* thanks, gcc */ |
|---|
| 565 | 572 | break; |
|---|
| 566 | | - }; |
|---|
| 573 | + } |
|---|
| 567 | 574 | |
|---|
| 568 | 575 | ocfs2_build_lock_name(type, OCFS2_I(inode)->ip_blkno, |
|---|
| 569 | 576 | generation, res->l_name); |
|---|
| .. | .. |
|---|
| 692 | 699 | { |
|---|
| 693 | 700 | struct ocfs2_lock_res *lockres = &osb->osb_trim_fs_lockres; |
|---|
| 694 | 701 | |
|---|
| 702 | + /* Only one trimfs thread are allowed to work at the same time. */ |
|---|
| 703 | + mutex_lock(&osb->obs_trim_fs_mutex); |
|---|
| 704 | + |
|---|
| 695 | 705 | ocfs2_lock_res_init_once(lockres); |
|---|
| 696 | 706 | ocfs2_build_lock_name(OCFS2_LOCK_TYPE_TRIM_FS, 0, 0, lockres->l_name); |
|---|
| 697 | 707 | ocfs2_lock_res_init_common(osb, lockres, OCFS2_LOCK_TYPE_TRIM_FS, |
|---|
| .. | .. |
|---|
| 704 | 714 | |
|---|
| 705 | 715 | ocfs2_simple_drop_lockres(osb, lockres); |
|---|
| 706 | 716 | ocfs2_lock_res_free(lockres); |
|---|
| 717 | + |
|---|
| 718 | + mutex_unlock(&osb->obs_trim_fs_mutex); |
|---|
| 707 | 719 | } |
|---|
| 708 | 720 | |
|---|
| 709 | 721 | static void ocfs2_orphan_scan_lock_res_init(struct ocfs2_lock_res *res, |
|---|
| .. | .. |
|---|
| 890 | 902 | list_del_init(&mw->mw_item); |
|---|
| 891 | 903 | mw->mw_status = 0; |
|---|
| 892 | 904 | complete(&mw->mw_complete); |
|---|
| 905 | + ocfs2_track_lock_wait(lockres); |
|---|
| 893 | 906 | } |
|---|
| 894 | 907 | } |
|---|
| 895 | 908 | static void lockres_or_flags(struct ocfs2_lock_res *lockres, unsigned long or) |
|---|
| .. | .. |
|---|
| 1401 | 1414 | list_add_tail(&mw->mw_item, &lockres->l_mask_waiters); |
|---|
| 1402 | 1415 | mw->mw_mask = mask; |
|---|
| 1403 | 1416 | mw->mw_goal = goal; |
|---|
| 1417 | + ocfs2_track_lock_wait(lockres); |
|---|
| 1404 | 1418 | } |
|---|
| 1405 | 1419 | |
|---|
| 1406 | 1420 | /* returns 0 if the mw that was removed was already satisfied, -EBUSY |
|---|
| .. | .. |
|---|
| 1417 | 1431 | |
|---|
| 1418 | 1432 | list_del_init(&mw->mw_item); |
|---|
| 1419 | 1433 | init_completion(&mw->mw_complete); |
|---|
| 1434 | + ocfs2_track_lock_wait(lockres); |
|---|
| 1420 | 1435 | } |
|---|
| 1421 | 1436 | |
|---|
| 1422 | 1437 | return ret; |
|---|
| .. | .. |
|---|
| 1678 | 1693 | spin_unlock_irqrestore(&lockres->l_lock, flags); |
|---|
| 1679 | 1694 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
|---|
| 1680 | 1695 | if (lockres->l_lockdep_map.key != NULL) |
|---|
| 1681 | | - rwsem_release(&lockres->l_lockdep_map, 1, caller_ip); |
|---|
| 1696 | + rwsem_release(&lockres->l_lockdep_map, caller_ip); |
|---|
| 1682 | 1697 | #endif |
|---|
| 1683 | 1698 | } |
|---|
| 1684 | 1699 | |
|---|
| .. | .. |
|---|
| 2124 | 2139 | } |
|---|
| 2125 | 2140 | |
|---|
| 2126 | 2141 | #define OCFS2_SEC_BITS 34 |
|---|
| 2127 | | -#define OCFS2_SEC_SHIFT (64 - 34) |
|---|
| 2142 | +#define OCFS2_SEC_SHIFT (64 - OCFS2_SEC_BITS) |
|---|
| 2128 | 2143 | #define OCFS2_NSEC_MASK ((1ULL << OCFS2_SEC_SHIFT) - 1) |
|---|
| 2129 | 2144 | |
|---|
| 2130 | 2145 | /* LVB only has room for 64 bits of time here so we pack it for |
|---|
| 2131 | 2146 | * now. */ |
|---|
| 2132 | | -static u64 ocfs2_pack_timespec(struct timespec *spec) |
|---|
| 2147 | +static u64 ocfs2_pack_timespec(struct timespec64 *spec) |
|---|
| 2133 | 2148 | { |
|---|
| 2134 | 2149 | u64 res; |
|---|
| 2135 | | - u64 sec = spec->tv_sec; |
|---|
| 2150 | + u64 sec = clamp_t(time64_t, spec->tv_sec, 0, 0x3ffffffffull); |
|---|
| 2136 | 2151 | u32 nsec = spec->tv_nsec; |
|---|
| 2137 | 2152 | |
|---|
| 2138 | 2153 | res = (sec << OCFS2_SEC_SHIFT) | (nsec & OCFS2_NSEC_MASK); |
|---|
| .. | .. |
|---|
| 2148 | 2163 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
|---|
| 2149 | 2164 | struct ocfs2_lock_res *lockres = &oi->ip_inode_lockres; |
|---|
| 2150 | 2165 | struct ocfs2_meta_lvb *lvb; |
|---|
| 2151 | | - struct timespec ts; |
|---|
| 2152 | 2166 | |
|---|
| 2153 | 2167 | lvb = ocfs2_dlm_lvb(&lockres->l_lksb); |
|---|
| 2154 | 2168 | |
|---|
| .. | .. |
|---|
| 2169 | 2183 | lvb->lvb_igid = cpu_to_be32(i_gid_read(inode)); |
|---|
| 2170 | 2184 | lvb->lvb_imode = cpu_to_be16(inode->i_mode); |
|---|
| 2171 | 2185 | lvb->lvb_inlink = cpu_to_be16(inode->i_nlink); |
|---|
| 2172 | | - ts = timespec64_to_timespec(inode->i_atime); |
|---|
| 2173 | 2186 | lvb->lvb_iatime_packed = |
|---|
| 2174 | | - cpu_to_be64(ocfs2_pack_timespec(&ts)); |
|---|
| 2175 | | - ts = timespec64_to_timespec(inode->i_ctime); |
|---|
| 2187 | + cpu_to_be64(ocfs2_pack_timespec(&inode->i_atime)); |
|---|
| 2176 | 2188 | lvb->lvb_ictime_packed = |
|---|
| 2177 | | - cpu_to_be64(ocfs2_pack_timespec(&ts)); |
|---|
| 2178 | | - ts = timespec64_to_timespec(inode->i_mtime); |
|---|
| 2189 | + cpu_to_be64(ocfs2_pack_timespec(&inode->i_ctime)); |
|---|
| 2179 | 2190 | lvb->lvb_imtime_packed = |
|---|
| 2180 | | - cpu_to_be64(ocfs2_pack_timespec(&ts)); |
|---|
| 2191 | + cpu_to_be64(ocfs2_pack_timespec(&inode->i_mtime)); |
|---|
| 2181 | 2192 | lvb->lvb_iattr = cpu_to_be32(oi->ip_attr); |
|---|
| 2182 | 2193 | lvb->lvb_idynfeatures = cpu_to_be16(oi->ip_dyn_features); |
|---|
| 2183 | 2194 | lvb->lvb_igeneration = cpu_to_be32(inode->i_generation); |
|---|
| .. | .. |
|---|
| 2186 | 2197 | mlog_meta_lvb(0, lockres); |
|---|
| 2187 | 2198 | } |
|---|
| 2188 | 2199 | |
|---|
| 2189 | | -static void ocfs2_unpack_timespec(struct timespec *spec, |
|---|
| 2200 | +static void ocfs2_unpack_timespec(struct timespec64 *spec, |
|---|
| 2190 | 2201 | u64 packed_time) |
|---|
| 2191 | 2202 | { |
|---|
| 2192 | 2203 | spec->tv_sec = packed_time >> OCFS2_SEC_SHIFT; |
|---|
| .. | .. |
|---|
| 2195 | 2206 | |
|---|
| 2196 | 2207 | static void ocfs2_refresh_inode_from_lvb(struct inode *inode) |
|---|
| 2197 | 2208 | { |
|---|
| 2198 | | - struct timespec ts; |
|---|
| 2199 | 2209 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
|---|
| 2200 | 2210 | struct ocfs2_lock_res *lockres = &oi->ip_inode_lockres; |
|---|
| 2201 | 2211 | struct ocfs2_meta_lvb *lvb; |
|---|
| .. | .. |
|---|
| 2223 | 2233 | i_gid_write(inode, be32_to_cpu(lvb->lvb_igid)); |
|---|
| 2224 | 2234 | inode->i_mode = be16_to_cpu(lvb->lvb_imode); |
|---|
| 2225 | 2235 | set_nlink(inode, be16_to_cpu(lvb->lvb_inlink)); |
|---|
| 2226 | | - ocfs2_unpack_timespec(&ts, |
|---|
| 2236 | + ocfs2_unpack_timespec(&inode->i_atime, |
|---|
| 2227 | 2237 | be64_to_cpu(lvb->lvb_iatime_packed)); |
|---|
| 2228 | | - inode->i_atime = timespec_to_timespec64(ts); |
|---|
| 2229 | | - ocfs2_unpack_timespec(&ts, |
|---|
| 2238 | + ocfs2_unpack_timespec(&inode->i_mtime, |
|---|
| 2230 | 2239 | be64_to_cpu(lvb->lvb_imtime_packed)); |
|---|
| 2231 | | - inode->i_mtime = timespec_to_timespec64(ts); |
|---|
| 2232 | | - ocfs2_unpack_timespec(&ts, |
|---|
| 2240 | + ocfs2_unpack_timespec(&inode->i_ctime, |
|---|
| 2233 | 2241 | be64_to_cpu(lvb->lvb_ictime_packed)); |
|---|
| 2234 | | - inode->i_ctime = timespec_to_timespec64(ts); |
|---|
| 2235 | 2242 | spin_unlock(&oi->ip_lock); |
|---|
| 2236 | 2243 | } |
|---|
| 2237 | 2244 | |
|---|
| .. | .. |
|---|
| 2507 | 2514 | ocfs2_inode_unlock(inode, ex); |
|---|
| 2508 | 2515 | } |
|---|
| 2509 | 2516 | |
|---|
| 2510 | | - if (local_bh) |
|---|
| 2511 | | - brelse(local_bh); |
|---|
| 2512 | | - |
|---|
| 2517 | + brelse(local_bh); |
|---|
| 2513 | 2518 | return status; |
|---|
| 2514 | 2519 | } |
|---|
| 2515 | 2520 | |
|---|
| .. | .. |
|---|
| 2592 | 2597 | *level = 1; |
|---|
| 2593 | 2598 | if (ocfs2_should_update_atime(inode, vfsmnt)) |
|---|
| 2594 | 2599 | ocfs2_update_inode_atime(inode, bh); |
|---|
| 2595 | | - if (bh) |
|---|
| 2596 | | - brelse(bh); |
|---|
| 2600 | + brelse(bh); |
|---|
| 2597 | 2601 | } else |
|---|
| 2598 | 2602 | *level = 0; |
|---|
| 2599 | 2603 | |
|---|
| .. | .. |
|---|
| 3026 | 3030 | |
|---|
| 3027 | 3031 | kref_init(&dlm_debug->d_refcnt); |
|---|
| 3028 | 3032 | INIT_LIST_HEAD(&dlm_debug->d_lockres_tracking); |
|---|
| 3029 | | - dlm_debug->d_locking_state = NULL; |
|---|
| 3033 | + dlm_debug->d_filter_secs = 0; |
|---|
| 3030 | 3034 | out: |
|---|
| 3031 | 3035 | return dlm_debug; |
|---|
| 3032 | 3036 | } |
|---|
| .. | .. |
|---|
| 3117 | 3121 | * - Lock stats printed |
|---|
| 3118 | 3122 | * New in version 3 |
|---|
| 3119 | 3123 | * - Max time in lock stats is in usecs (instead of nsecs) |
|---|
| 3124 | + * New in version 4 |
|---|
| 3125 | + * - Add last pr/ex unlock times and first lock wait time in usecs |
|---|
| 3120 | 3126 | */ |
|---|
| 3121 | | -#define OCFS2_DLM_DEBUG_STR_VERSION 3 |
|---|
| 3127 | +#define OCFS2_DLM_DEBUG_STR_VERSION 4 |
|---|
| 3122 | 3128 | static int ocfs2_dlm_seq_show(struct seq_file *m, void *v) |
|---|
| 3123 | 3129 | { |
|---|
| 3124 | 3130 | int i; |
|---|
| 3125 | 3131 | char *lvb; |
|---|
| 3126 | 3132 | struct ocfs2_lock_res *lockres = v; |
|---|
| 3133 | +#ifdef CONFIG_OCFS2_FS_STATS |
|---|
| 3134 | + u64 now, last; |
|---|
| 3135 | + struct ocfs2_dlm_debug *dlm_debug = |
|---|
| 3136 | + ((struct ocfs2_dlm_seq_priv *)m->private)->p_dlm_debug; |
|---|
| 3137 | +#endif |
|---|
| 3127 | 3138 | |
|---|
| 3128 | 3139 | if (!lockres) |
|---|
| 3129 | 3140 | return -EINVAL; |
|---|
| 3141 | + |
|---|
| 3142 | +#ifdef CONFIG_OCFS2_FS_STATS |
|---|
| 3143 | + if (!lockres->l_lock_wait && dlm_debug->d_filter_secs) { |
|---|
| 3144 | + now = ktime_to_us(ktime_get_real()); |
|---|
| 3145 | + if (lockres->l_lock_prmode.ls_last > |
|---|
| 3146 | + lockres->l_lock_exmode.ls_last) |
|---|
| 3147 | + last = lockres->l_lock_prmode.ls_last; |
|---|
| 3148 | + else |
|---|
| 3149 | + last = lockres->l_lock_exmode.ls_last; |
|---|
| 3150 | + /* |
|---|
| 3151 | + * Use d_filter_secs field to filter lock resources dump, |
|---|
| 3152 | + * the default d_filter_secs(0) value filters nothing, |
|---|
| 3153 | + * otherwise, only dump the last N seconds active lock |
|---|
| 3154 | + * resources. |
|---|
| 3155 | + */ |
|---|
| 3156 | + if (div_u64(now - last, 1000000) > dlm_debug->d_filter_secs) |
|---|
| 3157 | + return 0; |
|---|
| 3158 | + } |
|---|
| 3159 | +#endif |
|---|
| 3130 | 3160 | |
|---|
| 3131 | 3161 | seq_printf(m, "0x%x\t", OCFS2_DLM_DEBUG_STR_VERSION); |
|---|
| 3132 | 3162 | |
|---|
| .. | .. |
|---|
| 3169 | 3199 | # define lock_max_prmode(_l) ((_l)->l_lock_prmode.ls_max) |
|---|
| 3170 | 3200 | # define lock_max_exmode(_l) ((_l)->l_lock_exmode.ls_max) |
|---|
| 3171 | 3201 | # define lock_refresh(_l) ((_l)->l_lock_refresh) |
|---|
| 3202 | +# define lock_last_prmode(_l) ((_l)->l_lock_prmode.ls_last) |
|---|
| 3203 | +# define lock_last_exmode(_l) ((_l)->l_lock_exmode.ls_last) |
|---|
| 3204 | +# define lock_wait(_l) ((_l)->l_lock_wait) |
|---|
| 3172 | 3205 | #else |
|---|
| 3173 | 3206 | # define lock_num_prmode(_l) (0) |
|---|
| 3174 | 3207 | # define lock_num_exmode(_l) (0) |
|---|
| .. | .. |
|---|
| 3179 | 3212 | # define lock_max_prmode(_l) (0) |
|---|
| 3180 | 3213 | # define lock_max_exmode(_l) (0) |
|---|
| 3181 | 3214 | # define lock_refresh(_l) (0) |
|---|
| 3215 | +# define lock_last_prmode(_l) (0ULL) |
|---|
| 3216 | +# define lock_last_exmode(_l) (0ULL) |
|---|
| 3217 | +# define lock_wait(_l) (0ULL) |
|---|
| 3182 | 3218 | #endif |
|---|
| 3183 | 3219 | /* The following seq_print was added in version 2 of this output */ |
|---|
| 3184 | 3220 | seq_printf(m, "%u\t" |
|---|
| .. | .. |
|---|
| 3189 | 3225 | "%llu\t" |
|---|
| 3190 | 3226 | "%u\t" |
|---|
| 3191 | 3227 | "%u\t" |
|---|
| 3192 | | - "%u\t", |
|---|
| 3228 | + "%u\t" |
|---|
| 3229 | + "%llu\t" |
|---|
| 3230 | + "%llu\t" |
|---|
| 3231 | + "%llu\t", |
|---|
| 3193 | 3232 | lock_num_prmode(lockres), |
|---|
| 3194 | 3233 | lock_num_exmode(lockres), |
|---|
| 3195 | 3234 | lock_num_prmode_failed(lockres), |
|---|
| .. | .. |
|---|
| 3198 | 3237 | lock_total_exmode(lockres), |
|---|
| 3199 | 3238 | lock_max_prmode(lockres), |
|---|
| 3200 | 3239 | lock_max_exmode(lockres), |
|---|
| 3201 | | - lock_refresh(lockres)); |
|---|
| 3240 | + lock_refresh(lockres), |
|---|
| 3241 | + lock_last_prmode(lockres), |
|---|
| 3242 | + lock_last_exmode(lockres), |
|---|
| 3243 | + lock_wait(lockres)); |
|---|
| 3202 | 3244 | |
|---|
| 3203 | 3245 | /* End the line */ |
|---|
| 3204 | 3246 | seq_printf(m, "\n"); |
|---|
| .. | .. |
|---|
| 3252 | 3294 | .llseek = seq_lseek, |
|---|
| 3253 | 3295 | }; |
|---|
| 3254 | 3296 | |
|---|
| 3255 | | -static int ocfs2_dlm_init_debug(struct ocfs2_super *osb) |
|---|
| 3297 | +static void ocfs2_dlm_init_debug(struct ocfs2_super *osb) |
|---|
| 3256 | 3298 | { |
|---|
| 3257 | | - int ret = 0; |
|---|
| 3258 | 3299 | struct ocfs2_dlm_debug *dlm_debug = osb->osb_dlm_debug; |
|---|
| 3259 | 3300 | |
|---|
| 3260 | | - dlm_debug->d_locking_state = debugfs_create_file("locking_state", |
|---|
| 3261 | | - S_IFREG|S_IRUSR, |
|---|
| 3262 | | - osb->osb_debug_root, |
|---|
| 3263 | | - osb, |
|---|
| 3264 | | - &ocfs2_dlm_debug_fops); |
|---|
| 3265 | | - if (!dlm_debug->d_locking_state) { |
|---|
| 3266 | | - ret = -EINVAL; |
|---|
| 3267 | | - mlog(ML_ERROR, |
|---|
| 3268 | | - "Unable to create locking state debugfs file.\n"); |
|---|
| 3269 | | - goto out; |
|---|
| 3270 | | - } |
|---|
| 3301 | + debugfs_create_file("locking_state", S_IFREG|S_IRUSR, |
|---|
| 3302 | + osb->osb_debug_root, osb, &ocfs2_dlm_debug_fops); |
|---|
| 3271 | 3303 | |
|---|
| 3304 | + debugfs_create_u32("locking_filter", 0600, osb->osb_debug_root, |
|---|
| 3305 | + &dlm_debug->d_filter_secs); |
|---|
| 3272 | 3306 | ocfs2_get_dlm_debug(dlm_debug); |
|---|
| 3273 | | -out: |
|---|
| 3274 | | - return ret; |
|---|
| 3275 | 3307 | } |
|---|
| 3276 | 3308 | |
|---|
| 3277 | 3309 | static void ocfs2_dlm_shutdown_debug(struct ocfs2_super *osb) |
|---|
| 3278 | 3310 | { |
|---|
| 3279 | 3311 | struct ocfs2_dlm_debug *dlm_debug = osb->osb_dlm_debug; |
|---|
| 3280 | 3312 | |
|---|
| 3281 | | - if (dlm_debug) { |
|---|
| 3282 | | - debugfs_remove(dlm_debug->d_locking_state); |
|---|
| 3313 | + if (dlm_debug) |
|---|
| 3283 | 3314 | ocfs2_put_dlm_debug(dlm_debug); |
|---|
| 3284 | | - } |
|---|
| 3285 | 3315 | } |
|---|
| 3286 | 3316 | |
|---|
| 3287 | 3317 | int ocfs2_dlm_init(struct ocfs2_super *osb) |
|---|
| .. | .. |
|---|
| 3294 | 3324 | goto local; |
|---|
| 3295 | 3325 | } |
|---|
| 3296 | 3326 | |
|---|
| 3297 | | - status = ocfs2_dlm_init_debug(osb); |
|---|
| 3298 | | - if (status < 0) { |
|---|
| 3299 | | - mlog_errno(status); |
|---|
| 3300 | | - goto bail; |
|---|
| 3301 | | - } |
|---|
| 3327 | + ocfs2_dlm_init_debug(osb); |
|---|
| 3302 | 3328 | |
|---|
| 3303 | 3329 | /* launch downconvert thread */ |
|---|
| 3304 | 3330 | osb->dc_task = kthread_run(ocfs2_downconvert_thread, osb, "ocfs2dc-%s", |
|---|
| .. | .. |
|---|
| 3370 | 3396 | ocfs2_lock_res_free(&osb->osb_nfs_sync_lockres); |
|---|
| 3371 | 3397 | ocfs2_lock_res_free(&osb->osb_orphan_scan.os_lockres); |
|---|
| 3372 | 3398 | |
|---|
| 3373 | | - ocfs2_cluster_disconnect(osb->cconn, hangup_pending); |
|---|
| 3374 | | - osb->cconn = NULL; |
|---|
| 3399 | + if (osb->cconn) { |
|---|
| 3400 | + ocfs2_cluster_disconnect(osb->cconn, hangup_pending); |
|---|
| 3401 | + osb->cconn = NULL; |
|---|
| 3375 | 3402 | |
|---|
| 3376 | | - ocfs2_dlm_shutdown_debug(osb); |
|---|
| 3403 | + ocfs2_dlm_shutdown_debug(osb); |
|---|
| 3404 | + } |
|---|
| 3377 | 3405 | } |
|---|
| 3378 | 3406 | |
|---|
| 3379 | 3407 | static int ocfs2_drop_lock(struct ocfs2_super *osb, |
|---|
| .. | .. |
|---|
| 4391 | 4419 | |
|---|
| 4392 | 4420 | static int ocfs2_downconvert_thread(void *arg) |
|---|
| 4393 | 4421 | { |
|---|
| 4394 | | - int status = 0; |
|---|
| 4395 | 4422 | struct ocfs2_super *osb = arg; |
|---|
| 4396 | 4423 | |
|---|
| 4397 | 4424 | /* only quit once we've been asked to stop and there is no more |
|---|
| .. | .. |
|---|
| 4409 | 4436 | } |
|---|
| 4410 | 4437 | |
|---|
| 4411 | 4438 | osb->dc_task = NULL; |
|---|
| 4412 | | - return status; |
|---|
| 4439 | + return 0; |
|---|
| 4413 | 4440 | } |
|---|
| 4414 | 4441 | |
|---|
| 4415 | 4442 | void ocfs2_wake_downconvert_thread(struct ocfs2_super *osb) |
|---|