Thomas Gleixner | 328970d | 2019-05-24 12:04:05 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Kurt Hackel | 6714d8e | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 2 | /* -*- mode: c; c-basic-offset: 8; -*- |
| 3 | * vim: noexpandtab sw=8 ts=8 sts=0: |
| 4 | * |
| 5 | * dlmdebug.c |
| 6 | * |
| 7 | * debug functionality for the dlm |
| 8 | * |
Sunil Mushran | c834cdb | 2008-03-10 15:16:29 -0700 | [diff] [blame] | 9 | * Copyright (C) 2004, 2008 Oracle. All rights reserved. |
Kurt Hackel | 6714d8e | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #include <linux/types.h> |
| 13 | #include <linux/slab.h> |
| 14 | #include <linux/highmem.h> |
Kurt Hackel | 6714d8e | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 15 | #include <linux/sysctl.h> |
| 16 | #include <linux/spinlock.h> |
Sunil Mushran | 6325b4a | 2008-03-10 15:16:22 -0700 | [diff] [blame] | 17 | #include <linux/debugfs.h> |
Paul Gortmaker | afeacc8 | 2011-05-26 16:00:52 -0400 | [diff] [blame] | 18 | #include <linux/export.h> |
Kurt Hackel | 6714d8e | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 19 | |
| 20 | #include "cluster/heartbeat.h" |
| 21 | #include "cluster/nodemanager.h" |
| 22 | #include "cluster/tcp.h" |
| 23 | |
| 24 | #include "dlmapi.h" |
| 25 | #include "dlmcommon.h" |
Kurt Hackel | 6714d8e | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 26 | #include "dlmdomain.h" |
Sunil Mushran | 6325b4a | 2008-03-10 15:16:22 -0700 | [diff] [blame] | 27 | #include "dlmdebug.h" |
Kurt Hackel | 6714d8e | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 28 | |
| 29 | #define MLOG_MASK_PREFIX ML_DLM |
| 30 | #include "cluster/masklog.h" |
| 31 | |
Adrian Bunk | 95642e5 | 2008-04-21 11:49:37 +0300 | [diff] [blame] | 32 | static int stringify_lockname(const char *lockname, int locklen, char *buf, |
| 33 | int len); |
Sunil Mushran | c834cdb | 2008-03-10 15:16:29 -0700 | [diff] [blame] | 34 | |
Kurt Hackel | 6714d8e | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 35 | void dlm_print_one_lock_resource(struct dlm_lock_resource *res) |
| 36 | { |
Kurt Hackel | 6714d8e | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 37 | spin_lock(&res->spinlock); |
| 38 | __dlm_print_one_lock_resource(res); |
| 39 | spin_unlock(&res->spinlock); |
| 40 | } |
| 41 | |
Kurt Hackel | ba2bf21 | 2006-12-01 14:47:20 -0800 | [diff] [blame] | 42 | static void dlm_print_lockres_refmap(struct dlm_lock_resource *res) |
| 43 | { |
| 44 | int bit; |
| 45 | assert_spin_locked(&res->spinlock); |
| 46 | |
Sunil Mushran | 8f50eb9 | 2008-03-14 11:18:24 -0700 | [diff] [blame] | 47 | printk(" refmap nodes: [ "); |
Kurt Hackel | ba2bf21 | 2006-12-01 14:47:20 -0800 | [diff] [blame] | 48 | bit = 0; |
| 49 | while (1) { |
| 50 | bit = find_next_bit(res->refmap, O2NM_MAX_NODES, bit); |
| 51 | if (bit >= O2NM_MAX_NODES) |
| 52 | break; |
Sunil Mushran | 8f50eb9 | 2008-03-14 11:18:24 -0700 | [diff] [blame] | 53 | printk("%u ", bit); |
Kurt Hackel | ba2bf21 | 2006-12-01 14:47:20 -0800 | [diff] [blame] | 54 | bit++; |
| 55 | } |
Sunil Mushran | 8f50eb9 | 2008-03-14 11:18:24 -0700 | [diff] [blame] | 56 | printk("], inflight=%u\n", res->inflight_locks); |
Sunil Mushran | c834cdb | 2008-03-10 15:16:29 -0700 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | static void __dlm_print_lock(struct dlm_lock *lock) |
| 60 | { |
| 61 | spin_lock(&lock->spinlock); |
| 62 | |
Sunil Mushran | 8f50eb9 | 2008-03-14 11:18:24 -0700 | [diff] [blame] | 63 | printk(" type=%d, conv=%d, node=%u, cookie=%u:%llu, " |
Sunil Mushran | c834cdb | 2008-03-10 15:16:29 -0700 | [diff] [blame] | 64 | "ref=%u, ast=(empty=%c,pend=%c), bast=(empty=%c,pend=%c), " |
| 65 | "pending=(conv=%c,lock=%c,cancel=%c,unlock=%c)\n", |
| 66 | lock->ml.type, lock->ml.convert_type, lock->ml.node, |
| 67 | dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), |
| 68 | dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), |
Peter Zijlstra | 2c935bc | 2016-11-14 17:29:48 +0100 | [diff] [blame] | 69 | kref_read(&lock->lock_refs), |
Sunil Mushran | c834cdb | 2008-03-10 15:16:29 -0700 | [diff] [blame] | 70 | (list_empty(&lock->ast_list) ? 'y' : 'n'), |
| 71 | (lock->ast_pending ? 'y' : 'n'), |
| 72 | (list_empty(&lock->bast_list) ? 'y' : 'n'), |
| 73 | (lock->bast_pending ? 'y' : 'n'), |
| 74 | (lock->convert_pending ? 'y' : 'n'), |
| 75 | (lock->lock_pending ? 'y' : 'n'), |
| 76 | (lock->cancel_pending ? 'y' : 'n'), |
| 77 | (lock->unlock_pending ? 'y' : 'n')); |
| 78 | |
| 79 | spin_unlock(&lock->spinlock); |
Kurt Hackel | ba2bf21 | 2006-12-01 14:47:20 -0800 | [diff] [blame] | 80 | } |
| 81 | |
Kurt Hackel | 6714d8e | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 82 | void __dlm_print_one_lock_resource(struct dlm_lock_resource *res) |
| 83 | { |
Kurt Hackel | 6714d8e | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 84 | struct dlm_lock *lock; |
Sunil Mushran | c834cdb | 2008-03-10 15:16:29 -0700 | [diff] [blame] | 85 | char buf[DLM_LOCKID_NAME_MAX]; |
Kurt Hackel | 6714d8e | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 86 | |
| 87 | assert_spin_locked(&res->spinlock); |
| 88 | |
Sunil Mushran | c834cdb | 2008-03-10 15:16:29 -0700 | [diff] [blame] | 89 | stringify_lockname(res->lockname.name, res->lockname.len, |
Sunil Mushran | 86a06ab | 2010-02-05 17:55:56 -0800 | [diff] [blame] | 90 | buf, sizeof(buf)); |
Sunil Mushran | 8f50eb9 | 2008-03-14 11:18:24 -0700 | [diff] [blame] | 91 | printk("lockres: %s, owner=%u, state=%u\n", |
Sunil Mushran | c834cdb | 2008-03-10 15:16:29 -0700 | [diff] [blame] | 92 | buf, res->owner, res->state); |
Sunil Mushran | 8f50eb9 | 2008-03-14 11:18:24 -0700 | [diff] [blame] | 93 | printk(" last used: %lu, refcnt: %u, on purge list: %s\n", |
Peter Zijlstra | 2c935bc | 2016-11-14 17:29:48 +0100 | [diff] [blame] | 94 | res->last_used, kref_read(&res->refs), |
Sunil Mushran | c834cdb | 2008-03-10 15:16:29 -0700 | [diff] [blame] | 95 | list_empty(&res->purge) ? "no" : "yes"); |
Sunil Mushran | 8f50eb9 | 2008-03-14 11:18:24 -0700 | [diff] [blame] | 96 | printk(" on dirty list: %s, on reco list: %s, " |
Sunil Mushran | c834cdb | 2008-03-10 15:16:29 -0700 | [diff] [blame] | 97 | "migrating pending: %s\n", |
| 98 | list_empty(&res->dirty) ? "no" : "yes", |
| 99 | list_empty(&res->recovering) ? "no" : "yes", |
| 100 | res->migration_pending ? "yes" : "no"); |
Sunil Mushran | 8f50eb9 | 2008-03-14 11:18:24 -0700 | [diff] [blame] | 101 | printk(" inflight locks: %d, asts reserved: %d\n", |
Sunil Mushran | c834cdb | 2008-03-10 15:16:29 -0700 | [diff] [blame] | 102 | res->inflight_locks, atomic_read(&res->asts_reserved)); |
Kurt Hackel | ba2bf21 | 2006-12-01 14:47:20 -0800 | [diff] [blame] | 103 | dlm_print_lockres_refmap(res); |
Sunil Mushran | 8f50eb9 | 2008-03-14 11:18:24 -0700 | [diff] [blame] | 104 | printk(" granted queue:\n"); |
Dong Fang | df53cd3 | 2013-09-11 14:19:50 -0700 | [diff] [blame] | 105 | list_for_each_entry(lock, &res->granted, list) { |
Sunil Mushran | c834cdb | 2008-03-10 15:16:29 -0700 | [diff] [blame] | 106 | __dlm_print_lock(lock); |
Kurt Hackel | 6714d8e | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 107 | } |
Sunil Mushran | 8f50eb9 | 2008-03-14 11:18:24 -0700 | [diff] [blame] | 108 | printk(" converting queue:\n"); |
Dong Fang | df53cd3 | 2013-09-11 14:19:50 -0700 | [diff] [blame] | 109 | list_for_each_entry(lock, &res->converting, list) { |
Sunil Mushran | c834cdb | 2008-03-10 15:16:29 -0700 | [diff] [blame] | 110 | __dlm_print_lock(lock); |
Kurt Hackel | 6714d8e | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 111 | } |
Sunil Mushran | 8f50eb9 | 2008-03-14 11:18:24 -0700 | [diff] [blame] | 112 | printk(" blocked queue:\n"); |
Dong Fang | df53cd3 | 2013-09-11 14:19:50 -0700 | [diff] [blame] | 113 | list_for_each_entry(lock, &res->blocked, list) { |
Sunil Mushran | c834cdb | 2008-03-10 15:16:29 -0700 | [diff] [blame] | 114 | __dlm_print_lock(lock); |
Kurt Hackel | 6714d8e | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 115 | } |
| 116 | } |
| 117 | |
| 118 | void dlm_print_one_lock(struct dlm_lock *lockid) |
| 119 | { |
| 120 | dlm_print_one_lock_resource(lockid->lockres); |
| 121 | } |
| 122 | EXPORT_SYMBOL_GPL(dlm_print_one_lock); |
| 123 | |
Kurt Hackel | 6714d8e | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 124 | static const char *dlm_errnames[] = { |
| 125 | [DLM_NORMAL] = "DLM_NORMAL", |
| 126 | [DLM_GRANTED] = "DLM_GRANTED", |
| 127 | [DLM_DENIED] = "DLM_DENIED", |
| 128 | [DLM_DENIED_NOLOCKS] = "DLM_DENIED_NOLOCKS", |
| 129 | [DLM_WORKING] = "DLM_WORKING", |
| 130 | [DLM_BLOCKED] = "DLM_BLOCKED", |
| 131 | [DLM_BLOCKED_ORPHAN] = "DLM_BLOCKED_ORPHAN", |
| 132 | [DLM_DENIED_GRACE_PERIOD] = "DLM_DENIED_GRACE_PERIOD", |
| 133 | [DLM_SYSERR] = "DLM_SYSERR", |
| 134 | [DLM_NOSUPPORT] = "DLM_NOSUPPORT", |
| 135 | [DLM_CANCELGRANT] = "DLM_CANCELGRANT", |
| 136 | [DLM_IVLOCKID] = "DLM_IVLOCKID", |
| 137 | [DLM_SYNC] = "DLM_SYNC", |
| 138 | [DLM_BADTYPE] = "DLM_BADTYPE", |
| 139 | [DLM_BADRESOURCE] = "DLM_BADRESOURCE", |
| 140 | [DLM_MAXHANDLES] = "DLM_MAXHANDLES", |
| 141 | [DLM_NOCLINFO] = "DLM_NOCLINFO", |
| 142 | [DLM_NOLOCKMGR] = "DLM_NOLOCKMGR", |
| 143 | [DLM_NOPURGED] = "DLM_NOPURGED", |
| 144 | [DLM_BADARGS] = "DLM_BADARGS", |
| 145 | [DLM_VOID] = "DLM_VOID", |
| 146 | [DLM_NOTQUEUED] = "DLM_NOTQUEUED", |
| 147 | [DLM_IVBUFLEN] = "DLM_IVBUFLEN", |
| 148 | [DLM_CVTUNGRANT] = "DLM_CVTUNGRANT", |
| 149 | [DLM_BADPARAM] = "DLM_BADPARAM", |
| 150 | [DLM_VALNOTVALID] = "DLM_VALNOTVALID", |
| 151 | [DLM_REJECTED] = "DLM_REJECTED", |
| 152 | [DLM_ABORT] = "DLM_ABORT", |
| 153 | [DLM_CANCEL] = "DLM_CANCEL", |
| 154 | [DLM_IVRESHANDLE] = "DLM_IVRESHANDLE", |
| 155 | [DLM_DEADLOCK] = "DLM_DEADLOCK", |
| 156 | [DLM_DENIED_NOASTS] = "DLM_DENIED_NOASTS", |
| 157 | [DLM_FORWARD] = "DLM_FORWARD", |
| 158 | [DLM_TIMEOUT] = "DLM_TIMEOUT", |
| 159 | [DLM_IVGROUPID] = "DLM_IVGROUPID", |
| 160 | [DLM_VERS_CONFLICT] = "DLM_VERS_CONFLICT", |
| 161 | [DLM_BAD_DEVICE_PATH] = "DLM_BAD_DEVICE_PATH", |
| 162 | [DLM_NO_DEVICE_PERMISSION] = "DLM_NO_DEVICE_PERMISSION", |
| 163 | [DLM_NO_CONTROL_DEVICE ] = "DLM_NO_CONTROL_DEVICE ", |
| 164 | [DLM_RECOVERING] = "DLM_RECOVERING", |
| 165 | [DLM_MIGRATING] = "DLM_MIGRATING", |
| 166 | [DLM_MAXSTATS] = "DLM_MAXSTATS", |
| 167 | }; |
| 168 | |
| 169 | static const char *dlm_errmsgs[] = { |
| 170 | [DLM_NORMAL] = "request in progress", |
| 171 | [DLM_GRANTED] = "request granted", |
| 172 | [DLM_DENIED] = "request denied", |
| 173 | [DLM_DENIED_NOLOCKS] = "request denied, out of system resources", |
| 174 | [DLM_WORKING] = "async request in progress", |
| 175 | [DLM_BLOCKED] = "lock request blocked", |
| 176 | [DLM_BLOCKED_ORPHAN] = "lock request blocked by a orphan lock", |
| 177 | [DLM_DENIED_GRACE_PERIOD] = "topological change in progress", |
| 178 | [DLM_SYSERR] = "system error", |
| 179 | [DLM_NOSUPPORT] = "unsupported", |
| 180 | [DLM_CANCELGRANT] = "can't cancel convert: already granted", |
| 181 | [DLM_IVLOCKID] = "bad lockid", |
| 182 | [DLM_SYNC] = "synchronous request granted", |
| 183 | [DLM_BADTYPE] = "bad resource type", |
| 184 | [DLM_BADRESOURCE] = "bad resource handle", |
| 185 | [DLM_MAXHANDLES] = "no more resource handles", |
| 186 | [DLM_NOCLINFO] = "can't contact cluster manager", |
| 187 | [DLM_NOLOCKMGR] = "can't contact lock manager", |
| 188 | [DLM_NOPURGED] = "can't contact purge daemon", |
| 189 | [DLM_BADARGS] = "bad api args", |
| 190 | [DLM_VOID] = "no status", |
| 191 | [DLM_NOTQUEUED] = "NOQUEUE was specified and request failed", |
| 192 | [DLM_IVBUFLEN] = "invalid resource name length", |
| 193 | [DLM_CVTUNGRANT] = "attempted to convert ungranted lock", |
| 194 | [DLM_BADPARAM] = "invalid lock mode specified", |
| 195 | [DLM_VALNOTVALID] = "value block has been invalidated", |
| 196 | [DLM_REJECTED] = "request rejected, unrecognized client", |
| 197 | [DLM_ABORT] = "blocked lock request cancelled", |
| 198 | [DLM_CANCEL] = "conversion request cancelled", |
| 199 | [DLM_IVRESHANDLE] = "invalid resource handle", |
| 200 | [DLM_DEADLOCK] = "deadlock recovery refused this request", |
| 201 | [DLM_DENIED_NOASTS] = "failed to allocate AST", |
| 202 | [DLM_FORWARD] = "request must wait for primary's response", |
| 203 | [DLM_TIMEOUT] = "timeout value for lock has expired", |
| 204 | [DLM_IVGROUPID] = "invalid group specification", |
| 205 | [DLM_VERS_CONFLICT] = "version conflicts prevent request handling", |
| 206 | [DLM_BAD_DEVICE_PATH] = "Locks device does not exist or path wrong", |
| 207 | [DLM_NO_DEVICE_PERMISSION] = "Client has insufficient perms for device", |
| 208 | [DLM_NO_CONTROL_DEVICE] = "Cannot set options on opened device ", |
| 209 | [DLM_RECOVERING] = "lock resource being recovered", |
| 210 | [DLM_MIGRATING] = "lock resource being migrated", |
| 211 | [DLM_MAXSTATS] = "invalid error number", |
| 212 | }; |
| 213 | |
| 214 | const char *dlm_errmsg(enum dlm_status err) |
| 215 | { |
| 216 | if (err >= DLM_MAXSTATS || err < 0) |
| 217 | return dlm_errmsgs[DLM_MAXSTATS]; |
| 218 | return dlm_errmsgs[err]; |
| 219 | } |
| 220 | EXPORT_SYMBOL_GPL(dlm_errmsg); |
| 221 | |
| 222 | const char *dlm_errname(enum dlm_status err) |
| 223 | { |
| 224 | if (err >= DLM_MAXSTATS || err < 0) |
| 225 | return dlm_errnames[DLM_MAXSTATS]; |
| 226 | return dlm_errnames[err]; |
| 227 | } |
| 228 | EXPORT_SYMBOL_GPL(dlm_errname); |
Sunil Mushran | 6325b4a | 2008-03-10 15:16:22 -0700 | [diff] [blame] | 229 | |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 230 | /* NOTE: This function converts a lockname into a string. It uses knowledge |
| 231 | * of the format of the lockname that should be outside the purview of the dlm. |
| 232 | * We are adding only to make dlm debugging slightly easier. |
| 233 | * |
| 234 | * For more on lockname formats, please refer to dlmglue.c and ocfs2_lockid.h. |
| 235 | */ |
Adrian Bunk | 95642e5 | 2008-04-21 11:49:37 +0300 | [diff] [blame] | 236 | static int stringify_lockname(const char *lockname, int locklen, char *buf, |
| 237 | int len) |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 238 | { |
| 239 | int out = 0; |
| 240 | __be64 inode_blkno_be; |
| 241 | |
| 242 | #define OCFS2_DENTRY_LOCK_INO_START 18 |
| 243 | if (*lockname == 'N') { |
| 244 | memcpy((__be64 *)&inode_blkno_be, |
| 245 | (char *)&lockname[OCFS2_DENTRY_LOCK_INO_START], |
| 246 | sizeof(__be64)); |
| 247 | out += snprintf(buf + out, len - out, "%.*s%08x", |
| 248 | OCFS2_DENTRY_LOCK_INO_START - 1, lockname, |
| 249 | (unsigned int)be64_to_cpu(inode_blkno_be)); |
| 250 | } else |
| 251 | out += snprintf(buf + out, len - out, "%.*s", |
| 252 | locklen, lockname); |
| 253 | return out; |
| 254 | } |
| 255 | |
Sunil Mushran | e5a0334 | 2008-03-10 15:16:28 -0700 | [diff] [blame] | 256 | static int stringify_nodemap(unsigned long *nodemap, int maxnodes, |
| 257 | char *buf, int len) |
| 258 | { |
| 259 | int out = 0; |
| 260 | int i = -1; |
| 261 | |
| 262 | while ((i = find_next_bit(nodemap, maxnodes, i + 1)) < maxnodes) |
| 263 | out += snprintf(buf + out, len - out, "%d ", i); |
| 264 | |
| 265 | return out; |
| 266 | } |
| 267 | |
| 268 | static int dump_mle(struct dlm_master_list_entry *mle, char *buf, int len) |
| 269 | { |
| 270 | int out = 0; |
Sunil Mushran | e5a0334 | 2008-03-10 15:16:28 -0700 | [diff] [blame] | 271 | char *mle_type; |
| 272 | |
Sunil Mushran | e5a0334 | 2008-03-10 15:16:28 -0700 | [diff] [blame] | 273 | if (mle->type == DLM_MLE_BLOCK) |
| 274 | mle_type = "BLK"; |
| 275 | else if (mle->type == DLM_MLE_MASTER) |
| 276 | mle_type = "MAS"; |
| 277 | else |
| 278 | mle_type = "MIG"; |
| 279 | |
Sunil Mushran | 7141514 | 2009-02-26 15:00:47 -0800 | [diff] [blame] | 280 | out += stringify_lockname(mle->mname, mle->mnamelen, buf + out, len - out); |
Sunil Mushran | e5a0334 | 2008-03-10 15:16:28 -0700 | [diff] [blame] | 281 | out += snprintf(buf + out, len - out, |
| 282 | "\t%3s\tmas=%3u\tnew=%3u\tevt=%1d\tuse=%1d\tref=%3d\n", |
| 283 | mle_type, mle->master, mle->new_master, |
| 284 | !list_empty(&mle->hb_events), |
| 285 | !!mle->inuse, |
Peter Zijlstra | 2c935bc | 2016-11-14 17:29:48 +0100 | [diff] [blame] | 286 | kref_read(&mle->mle_refs)); |
Sunil Mushran | e5a0334 | 2008-03-10 15:16:28 -0700 | [diff] [blame] | 287 | |
| 288 | out += snprintf(buf + out, len - out, "Maybe="); |
| 289 | out += stringify_nodemap(mle->maybe_map, O2NM_MAX_NODES, |
| 290 | buf + out, len - out); |
| 291 | out += snprintf(buf + out, len - out, "\n"); |
| 292 | |
| 293 | out += snprintf(buf + out, len - out, "Vote="); |
| 294 | out += stringify_nodemap(mle->vote_map, O2NM_MAX_NODES, |
| 295 | buf + out, len - out); |
| 296 | out += snprintf(buf + out, len - out, "\n"); |
| 297 | |
| 298 | out += snprintf(buf + out, len - out, "Response="); |
| 299 | out += stringify_nodemap(mle->response_map, O2NM_MAX_NODES, |
| 300 | buf + out, len - out); |
| 301 | out += snprintf(buf + out, len - out, "\n"); |
| 302 | |
| 303 | out += snprintf(buf + out, len - out, "Node="); |
| 304 | out += stringify_nodemap(mle->node_map, O2NM_MAX_NODES, |
| 305 | buf + out, len - out); |
| 306 | out += snprintf(buf + out, len - out, "\n"); |
| 307 | |
| 308 | out += snprintf(buf + out, len - out, "\n"); |
| 309 | |
| 310 | return out; |
| 311 | } |
| 312 | |
| 313 | void dlm_print_one_mle(struct dlm_master_list_entry *mle) |
| 314 | { |
| 315 | char *buf; |
| 316 | |
Jia-Ju Bai | 9998657 | 2018-10-26 15:02:52 -0700 | [diff] [blame] | 317 | buf = (char *) get_zeroed_page(GFP_ATOMIC); |
Sunil Mushran | e5a0334 | 2008-03-10 15:16:28 -0700 | [diff] [blame] | 318 | if (buf) { |
| 319 | dump_mle(mle, buf, PAGE_SIZE - 1); |
| 320 | free_page((unsigned long)buf); |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | #ifdef CONFIG_DEBUG_FS |
| 325 | |
Fabian Frederick | 1a5c4e2 | 2014-06-04 16:06:06 -0700 | [diff] [blame] | 326 | static struct dentry *dlm_debugfs_root; |
Sunil Mushran | e5a0334 | 2008-03-10 15:16:28 -0700 | [diff] [blame] | 327 | |
Sunil Mushran | 6325b4a | 2008-03-10 15:16:22 -0700 | [diff] [blame] | 328 | #define DLM_DEBUGFS_DIR "o2dlm" |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 329 | #define DLM_DEBUGFS_DLM_STATE "dlm_state" |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 330 | #define DLM_DEBUGFS_LOCKING_STATE "locking_state" |
Sunil Mushran | d0129ac | 2008-03-10 15:16:26 -0700 | [diff] [blame] | 331 | #define DLM_DEBUGFS_MLE_STATE "mle_state" |
Sunil Mushran | 7209300 | 2008-03-10 15:16:27 -0700 | [diff] [blame] | 332 | #define DLM_DEBUGFS_PURGE_LIST "purge_list" |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 333 | |
| 334 | /* begin - utils funcs */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 335 | static int debug_release(struct inode *inode, struct file *file) |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 336 | { |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 337 | free_page((unsigned long)file->private_data); |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 338 | return 0; |
| 339 | } |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 340 | |
| 341 | static ssize_t debug_read(struct file *file, char __user *buf, |
| 342 | size_t nbytes, loff_t *ppos) |
| 343 | { |
| 344 | return simple_read_from_buffer(buf, nbytes, ppos, file->private_data, |
| 345 | i_size_read(file->f_mapping->host)); |
| 346 | } |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 347 | /* end - util funcs */ |
| 348 | |
Sunil Mushran | 7209300 | 2008-03-10 15:16:27 -0700 | [diff] [blame] | 349 | /* begin - purge list funcs */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 350 | static int debug_purgelist_print(struct dlm_ctxt *dlm, char *buf, int len) |
Sunil Mushran | 7209300 | 2008-03-10 15:16:27 -0700 | [diff] [blame] | 351 | { |
| 352 | struct dlm_lock_resource *res; |
| 353 | int out = 0; |
| 354 | unsigned long total = 0; |
| 355 | |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 356 | out += snprintf(buf + out, len - out, |
Sunil Mushran | 7209300 | 2008-03-10 15:16:27 -0700 | [diff] [blame] | 357 | "Dumping Purgelist for Domain: %s\n", dlm->name); |
| 358 | |
| 359 | spin_lock(&dlm->spinlock); |
| 360 | list_for_each_entry(res, &dlm->purge_list, purge) { |
| 361 | ++total; |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 362 | if (len - out < 100) |
Sunil Mushran | 7209300 | 2008-03-10 15:16:27 -0700 | [diff] [blame] | 363 | continue; |
| 364 | spin_lock(&res->spinlock); |
| 365 | out += stringify_lockname(res->lockname.name, |
| 366 | res->lockname.len, |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 367 | buf + out, len - out); |
| 368 | out += snprintf(buf + out, len - out, "\t%ld\n", |
Sunil Mushran | 7209300 | 2008-03-10 15:16:27 -0700 | [diff] [blame] | 369 | (jiffies - res->last_used)/HZ); |
| 370 | spin_unlock(&res->spinlock); |
| 371 | } |
| 372 | spin_unlock(&dlm->spinlock); |
| 373 | |
alex chen | 79c83ea | 2015-02-10 14:08:51 -0800 | [diff] [blame] | 374 | out += snprintf(buf + out, len - out, "Total on list: %lu\n", total); |
Sunil Mushran | 7209300 | 2008-03-10 15:16:27 -0700 | [diff] [blame] | 375 | |
| 376 | return out; |
| 377 | } |
| 378 | |
| 379 | static int debug_purgelist_open(struct inode *inode, struct file *file) |
| 380 | { |
| 381 | struct dlm_ctxt *dlm = inode->i_private; |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 382 | char *buf = NULL; |
Sunil Mushran | 7209300 | 2008-03-10 15:16:27 -0700 | [diff] [blame] | 383 | |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 384 | buf = (char *) get_zeroed_page(GFP_NOFS); |
| 385 | if (!buf) |
Sunil Mushran | 7209300 | 2008-03-10 15:16:27 -0700 | [diff] [blame] | 386 | goto bail; |
| 387 | |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 388 | i_size_write(inode, debug_purgelist_print(dlm, buf, PAGE_SIZE - 1)); |
Sunil Mushran | 7209300 | 2008-03-10 15:16:27 -0700 | [diff] [blame] | 389 | |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 390 | file->private_data = buf; |
Sunil Mushran | 7209300 | 2008-03-10 15:16:27 -0700 | [diff] [blame] | 391 | |
| 392 | return 0; |
| 393 | bail: |
| 394 | return -ENOMEM; |
| 395 | } |
| 396 | |
Alexey Dobriyan | 828c095 | 2009-10-01 15:43:56 -0700 | [diff] [blame] | 397 | static const struct file_operations debug_purgelist_fops = { |
Sunil Mushran | 7209300 | 2008-03-10 15:16:27 -0700 | [diff] [blame] | 398 | .open = debug_purgelist_open, |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 399 | .release = debug_release, |
| 400 | .read = debug_read, |
| 401 | .llseek = generic_file_llseek, |
Sunil Mushran | 7209300 | 2008-03-10 15:16:27 -0700 | [diff] [blame] | 402 | }; |
| 403 | /* end - purge list funcs */ |
| 404 | |
Sunil Mushran | d0129ac | 2008-03-10 15:16:26 -0700 | [diff] [blame] | 405 | /* begin - debug mle funcs */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 406 | static int debug_mle_print(struct dlm_ctxt *dlm, char *buf, int len) |
Sunil Mushran | d0129ac | 2008-03-10 15:16:26 -0700 | [diff] [blame] | 407 | { |
| 408 | struct dlm_master_list_entry *mle; |
Sunil Mushran | 2ed6c75 | 2009-02-26 15:00:41 -0800 | [diff] [blame] | 409 | struct hlist_head *bucket; |
Sunil Mushran | 2ed6c75 | 2009-02-26 15:00:41 -0800 | [diff] [blame] | 410 | int i, out = 0; |
Joel Becker | 93f3b86 | 2010-09-15 17:00:58 -0700 | [diff] [blame] | 411 | unsigned long total = 0, longest = 0, bucket_count = 0; |
Sunil Mushran | d0129ac | 2008-03-10 15:16:26 -0700 | [diff] [blame] | 412 | |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 413 | out += snprintf(buf + out, len - out, |
Sunil Mushran | d0129ac | 2008-03-10 15:16:26 -0700 | [diff] [blame] | 414 | "Dumping MLEs for Domain: %s\n", dlm->name); |
| 415 | |
| 416 | spin_lock(&dlm->master_lock); |
Sunil Mushran | 2ed6c75 | 2009-02-26 15:00:41 -0800 | [diff] [blame] | 417 | for (i = 0; i < DLM_HASH_BUCKETS; i++) { |
| 418 | bucket = dlm_master_hash(dlm, i); |
Dong Fang | df53cd3 | 2013-09-11 14:19:50 -0700 | [diff] [blame] | 419 | hlist_for_each_entry(mle, bucket, master_hash_node) { |
Sunil Mushran | 2ed6c75 | 2009-02-26 15:00:41 -0800 | [diff] [blame] | 420 | ++total; |
Joel Becker | 93f3b86 | 2010-09-15 17:00:58 -0700 | [diff] [blame] | 421 | ++bucket_count; |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 422 | if (len - out < 200) |
Sunil Mushran | 2ed6c75 | 2009-02-26 15:00:41 -0800 | [diff] [blame] | 423 | continue; |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 424 | out += dump_mle(mle, buf + out, len - out); |
Sunil Mushran | 2ed6c75 | 2009-02-26 15:00:41 -0800 | [diff] [blame] | 425 | } |
Joel Becker | 93f3b86 | 2010-09-15 17:00:58 -0700 | [diff] [blame] | 426 | longest = max(longest, bucket_count); |
| 427 | bucket_count = 0; |
Sunil Mushran | d0129ac | 2008-03-10 15:16:26 -0700 | [diff] [blame] | 428 | } |
| 429 | spin_unlock(&dlm->master_lock); |
| 430 | |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 431 | out += snprintf(buf + out, len - out, |
alex chen | 79c83ea | 2015-02-10 14:08:51 -0800 | [diff] [blame] | 432 | "Total: %lu, Longest: %lu\n", total, longest); |
Sunil Mushran | d0129ac | 2008-03-10 15:16:26 -0700 | [diff] [blame] | 433 | return out; |
| 434 | } |
| 435 | |
| 436 | static int debug_mle_open(struct inode *inode, struct file *file) |
| 437 | { |
| 438 | struct dlm_ctxt *dlm = inode->i_private; |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 439 | char *buf = NULL; |
Sunil Mushran | d0129ac | 2008-03-10 15:16:26 -0700 | [diff] [blame] | 440 | |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 441 | buf = (char *) get_zeroed_page(GFP_NOFS); |
| 442 | if (!buf) |
Sunil Mushran | d0129ac | 2008-03-10 15:16:26 -0700 | [diff] [blame] | 443 | goto bail; |
| 444 | |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 445 | i_size_write(inode, debug_mle_print(dlm, buf, PAGE_SIZE - 1)); |
Sunil Mushran | d0129ac | 2008-03-10 15:16:26 -0700 | [diff] [blame] | 446 | |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 447 | file->private_data = buf; |
Sunil Mushran | d0129ac | 2008-03-10 15:16:26 -0700 | [diff] [blame] | 448 | |
| 449 | return 0; |
| 450 | bail: |
| 451 | return -ENOMEM; |
| 452 | } |
| 453 | |
Alexey Dobriyan | 828c095 | 2009-10-01 15:43:56 -0700 | [diff] [blame] | 454 | static const struct file_operations debug_mle_fops = { |
Sunil Mushran | d0129ac | 2008-03-10 15:16:26 -0700 | [diff] [blame] | 455 | .open = debug_mle_open, |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 456 | .release = debug_release, |
| 457 | .read = debug_read, |
| 458 | .llseek = generic_file_llseek, |
Sunil Mushran | d0129ac | 2008-03-10 15:16:26 -0700 | [diff] [blame] | 459 | }; |
| 460 | |
| 461 | /* end - debug mle funcs */ |
| 462 | |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 463 | /* begin - debug lockres funcs */ |
| 464 | static int dump_lock(struct dlm_lock *lock, int list_type, char *buf, int len) |
| 465 | { |
| 466 | int out; |
| 467 | |
| 468 | #define DEBUG_LOCK_VERSION 1 |
| 469 | spin_lock(&lock->spinlock); |
| 470 | out = snprintf(buf, len, "LOCK:%d,%d,%d,%d,%d,%d:%lld,%d,%d,%d,%d,%d," |
| 471 | "%d,%d,%d,%d\n", |
| 472 | DEBUG_LOCK_VERSION, |
| 473 | list_type, lock->ml.type, lock->ml.convert_type, |
| 474 | lock->ml.node, |
| 475 | dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), |
| 476 | dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), |
| 477 | !list_empty(&lock->ast_list), |
| 478 | !list_empty(&lock->bast_list), |
| 479 | lock->ast_pending, lock->bast_pending, |
| 480 | lock->convert_pending, lock->lock_pending, |
| 481 | lock->cancel_pending, lock->unlock_pending, |
Peter Zijlstra | 2c935bc | 2016-11-14 17:29:48 +0100 | [diff] [blame] | 482 | kref_read(&lock->lock_refs)); |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 483 | spin_unlock(&lock->spinlock); |
| 484 | |
| 485 | return out; |
| 486 | } |
| 487 | |
| 488 | static int dump_lockres(struct dlm_lock_resource *res, char *buf, int len) |
| 489 | { |
| 490 | struct dlm_lock *lock; |
| 491 | int i; |
| 492 | int out = 0; |
| 493 | |
| 494 | out += snprintf(buf + out, len - out, "NAME:"); |
| 495 | out += stringify_lockname(res->lockname.name, res->lockname.len, |
| 496 | buf + out, len - out); |
| 497 | out += snprintf(buf + out, len - out, "\n"); |
| 498 | |
| 499 | #define DEBUG_LRES_VERSION 1 |
| 500 | out += snprintf(buf + out, len - out, |
| 501 | "LRES:%d,%d,%d,%ld,%d,%d,%d,%d,%d,%d,%d\n", |
| 502 | DEBUG_LRES_VERSION, |
| 503 | res->owner, res->state, res->last_used, |
| 504 | !list_empty(&res->purge), |
| 505 | !list_empty(&res->dirty), |
| 506 | !list_empty(&res->recovering), |
| 507 | res->inflight_locks, res->migration_pending, |
| 508 | atomic_read(&res->asts_reserved), |
Peter Zijlstra | 2c935bc | 2016-11-14 17:29:48 +0100 | [diff] [blame] | 509 | kref_read(&res->refs)); |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 510 | |
| 511 | /* refmap */ |
| 512 | out += snprintf(buf + out, len - out, "RMAP:"); |
| 513 | out += stringify_nodemap(res->refmap, O2NM_MAX_NODES, |
| 514 | buf + out, len - out); |
| 515 | out += snprintf(buf + out, len - out, "\n"); |
| 516 | |
| 517 | /* lvb */ |
| 518 | out += snprintf(buf + out, len - out, "LVBX:"); |
| 519 | for (i = 0; i < DLM_LVB_LEN; i++) |
| 520 | out += snprintf(buf + out, len - out, |
| 521 | "%02x", (unsigned char)res->lvb[i]); |
| 522 | out += snprintf(buf + out, len - out, "\n"); |
| 523 | |
| 524 | /* granted */ |
| 525 | list_for_each_entry(lock, &res->granted, list) |
| 526 | out += dump_lock(lock, 0, buf + out, len - out); |
| 527 | |
| 528 | /* converting */ |
| 529 | list_for_each_entry(lock, &res->converting, list) |
| 530 | out += dump_lock(lock, 1, buf + out, len - out); |
| 531 | |
| 532 | /* blocked */ |
| 533 | list_for_each_entry(lock, &res->blocked, list) |
| 534 | out += dump_lock(lock, 2, buf + out, len - out); |
| 535 | |
| 536 | out += snprintf(buf + out, len - out, "\n"); |
| 537 | |
| 538 | return out; |
| 539 | } |
| 540 | |
| 541 | static void *lockres_seq_start(struct seq_file *m, loff_t *pos) |
| 542 | { |
| 543 | struct debug_lockres *dl = m->private; |
| 544 | struct dlm_ctxt *dlm = dl->dl_ctxt; |
Sunil Mushran | b0d4f817 | 2008-12-16 15:49:22 -0800 | [diff] [blame] | 545 | struct dlm_lock_resource *oldres = dl->dl_res; |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 546 | struct dlm_lock_resource *res = NULL; |
Sunil Mushran | b0d4f817 | 2008-12-16 15:49:22 -0800 | [diff] [blame] | 547 | struct list_head *track_list; |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 548 | |
Sunil Mushran | b0d4f817 | 2008-12-16 15:49:22 -0800 | [diff] [blame] | 549 | spin_lock(&dlm->track_lock); |
| 550 | if (oldres) |
| 551 | track_list = &oldres->tracking; |
Tristan Ye | 228ac63 | 2010-09-10 10:16:33 +0800 | [diff] [blame] | 552 | else { |
Sunil Mushran | b0d4f817 | 2008-12-16 15:49:22 -0800 | [diff] [blame] | 553 | track_list = &dlm->tracking_list; |
Tristan Ye | 228ac63 | 2010-09-10 10:16:33 +0800 | [diff] [blame] | 554 | if (list_empty(track_list)) { |
| 555 | dl = NULL; |
| 556 | spin_unlock(&dlm->track_lock); |
| 557 | goto bail; |
| 558 | } |
| 559 | } |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 560 | |
Sunil Mushran | b0d4f817 | 2008-12-16 15:49:22 -0800 | [diff] [blame] | 561 | list_for_each_entry(res, track_list, tracking) { |
| 562 | if (&res->tracking == &dlm->tracking_list) |
| 563 | res = NULL; |
| 564 | else |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 565 | dlm_lockres_get(res); |
Sunil Mushran | b0d4f817 | 2008-12-16 15:49:22 -0800 | [diff] [blame] | 566 | break; |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 567 | } |
Sunil Mushran | b0d4f817 | 2008-12-16 15:49:22 -0800 | [diff] [blame] | 568 | spin_unlock(&dlm->track_lock); |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 569 | |
Sunil Mushran | b0d4f817 | 2008-12-16 15:49:22 -0800 | [diff] [blame] | 570 | if (oldres) |
| 571 | dlm_lockres_put(oldres); |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 572 | |
Sunil Mushran | b0d4f817 | 2008-12-16 15:49:22 -0800 | [diff] [blame] | 573 | dl->dl_res = res; |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 574 | |
Sunil Mushran | b0d4f817 | 2008-12-16 15:49:22 -0800 | [diff] [blame] | 575 | if (res) { |
| 576 | spin_lock(&res->spinlock); |
| 577 | dump_lockres(res, dl->dl_buf, dl->dl_len - 1); |
| 578 | spin_unlock(&res->spinlock); |
| 579 | } else |
| 580 | dl = NULL; |
| 581 | |
Tristan Ye | 228ac63 | 2010-09-10 10:16:33 +0800 | [diff] [blame] | 582 | bail: |
Sunil Mushran | b0d4f817 | 2008-12-16 15:49:22 -0800 | [diff] [blame] | 583 | /* passed to seq_show */ |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 584 | return dl; |
| 585 | } |
| 586 | |
| 587 | static void lockres_seq_stop(struct seq_file *m, void *v) |
| 588 | { |
| 589 | } |
| 590 | |
| 591 | static void *lockres_seq_next(struct seq_file *m, void *v, loff_t *pos) |
| 592 | { |
| 593 | return NULL; |
| 594 | } |
| 595 | |
| 596 | static int lockres_seq_show(struct seq_file *s, void *v) |
| 597 | { |
| 598 | struct debug_lockres *dl = (struct debug_lockres *)v; |
| 599 | |
| 600 | seq_printf(s, "%s", dl->dl_buf); |
| 601 | |
| 602 | return 0; |
| 603 | } |
| 604 | |
James Morris | 88e9d34 | 2009-09-22 16:43:43 -0700 | [diff] [blame] | 605 | static const struct seq_operations debug_lockres_ops = { |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 606 | .start = lockres_seq_start, |
| 607 | .stop = lockres_seq_stop, |
| 608 | .next = lockres_seq_next, |
| 609 | .show = lockres_seq_show, |
| 610 | }; |
| 611 | |
| 612 | static int debug_lockres_open(struct inode *inode, struct file *file) |
| 613 | { |
| 614 | struct dlm_ctxt *dlm = inode->i_private; |
Rob Jones | 8f9ac03 | 2014-10-09 15:25:05 -0700 | [diff] [blame] | 615 | struct debug_lockres *dl; |
| 616 | void *buf; |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 617 | |
Rob Jones | 8f9ac03 | 2014-10-09 15:25:05 -0700 | [diff] [blame] | 618 | buf = kmalloc(PAGE_SIZE, GFP_KERNEL); |
| 619 | if (!buf) |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 620 | goto bail; |
Rob Jones | 8f9ac03 | 2014-10-09 15:25:05 -0700 | [diff] [blame] | 621 | |
| 622 | dl = __seq_open_private(file, &debug_lockres_ops, sizeof(*dl)); |
| 623 | if (!dl) |
| 624 | goto bailfree; |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 625 | |
| 626 | dl->dl_len = PAGE_SIZE; |
Rob Jones | 8f9ac03 | 2014-10-09 15:25:05 -0700 | [diff] [blame] | 627 | dl->dl_buf = buf; |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 628 | |
| 629 | dlm_grab(dlm); |
| 630 | dl->dl_ctxt = dlm; |
| 631 | |
| 632 | return 0; |
Rob Jones | 8f9ac03 | 2014-10-09 15:25:05 -0700 | [diff] [blame] | 633 | |
| 634 | bailfree: |
| 635 | kfree(buf); |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 636 | bail: |
Rob Jones | 8f9ac03 | 2014-10-09 15:25:05 -0700 | [diff] [blame] | 637 | mlog_errno(-ENOMEM); |
| 638 | return -ENOMEM; |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 639 | } |
| 640 | |
| 641 | static int debug_lockres_release(struct inode *inode, struct file *file) |
| 642 | { |
Joe Perches | 33fa1d9 | 2010-07-12 13:50:19 -0700 | [diff] [blame] | 643 | struct seq_file *seq = file->private_data; |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 644 | struct debug_lockres *dl = (struct debug_lockres *)seq->private; |
| 645 | |
| 646 | if (dl->dl_res) |
| 647 | dlm_lockres_put(dl->dl_res); |
| 648 | dlm_put(dl->dl_ctxt); |
| 649 | kfree(dl->dl_buf); |
| 650 | return seq_release_private(inode, file); |
| 651 | } |
| 652 | |
Alexey Dobriyan | 828c095 | 2009-10-01 15:43:56 -0700 | [diff] [blame] | 653 | static const struct file_operations debug_lockres_fops = { |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 654 | .open = debug_lockres_open, |
| 655 | .release = debug_lockres_release, |
| 656 | .read = seq_read, |
| 657 | .llseek = seq_lseek, |
| 658 | }; |
| 659 | /* end - debug lockres funcs */ |
| 660 | |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 661 | /* begin - debug state funcs */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 662 | static int debug_state_print(struct dlm_ctxt *dlm, char *buf, int len) |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 663 | { |
| 664 | int out = 0; |
| 665 | struct dlm_reco_node_data *node; |
| 666 | char *state; |
Sunil Mushran | e64ff14 | 2009-02-26 15:00:46 -0800 | [diff] [blame] | 667 | int cur_mles = 0, tot_mles = 0; |
| 668 | int i; |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 669 | |
| 670 | spin_lock(&dlm->spinlock); |
| 671 | |
| 672 | switch (dlm->dlm_state) { |
| 673 | case DLM_CTXT_NEW: |
| 674 | state = "NEW"; break; |
| 675 | case DLM_CTXT_JOINED: |
| 676 | state = "JOINED"; break; |
| 677 | case DLM_CTXT_IN_SHUTDOWN: |
| 678 | state = "SHUTDOWN"; break; |
| 679 | case DLM_CTXT_LEAVING: |
| 680 | state = "LEAVING"; break; |
| 681 | default: |
| 682 | state = "UNKNOWN"; break; |
| 683 | } |
| 684 | |
| 685 | /* Domain: xxxxxxxxxx Key: 0xdfbac769 */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 686 | out += snprintf(buf + out, len - out, |
Sunil Mushran | b1365d0 | 2010-10-06 17:55:34 -0700 | [diff] [blame] | 687 | "Domain: %s Key: 0x%08x Protocol: %d.%d\n", |
| 688 | dlm->name, dlm->key, dlm->dlm_locking_proto.pv_major, |
| 689 | dlm->dlm_locking_proto.pv_minor); |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 690 | |
| 691 | /* Thread Pid: xxx Node: xxx State: xxxxx */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 692 | out += snprintf(buf + out, len - out, |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 693 | "Thread Pid: %d Node: %d State: %s\n", |
Sunil Mushran | 37096a7 | 2010-12-20 16:35:00 -0800 | [diff] [blame] | 694 | task_pid_nr(dlm->dlm_thread_task), dlm->node_num, state); |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 695 | |
| 696 | /* Number of Joins: xxx Joining Node: xxx */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 697 | out += snprintf(buf + out, len - out, |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 698 | "Number of Joins: %d Joining Node: %d\n", |
| 699 | dlm->num_joins, dlm->joining_node); |
| 700 | |
| 701 | /* Domain Map: xx xx xx */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 702 | out += snprintf(buf + out, len - out, "Domain Map: "); |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 703 | out += stringify_nodemap(dlm->domain_map, O2NM_MAX_NODES, |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 704 | buf + out, len - out); |
| 705 | out += snprintf(buf + out, len - out, "\n"); |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 706 | |
Sunil Mushran | bddefde | 2011-05-19 14:34:11 -0700 | [diff] [blame] | 707 | /* Exit Domain Map: xx xx xx */ |
| 708 | out += snprintf(buf + out, len - out, "Exit Domain Map: "); |
| 709 | out += stringify_nodemap(dlm->exit_domain_map, O2NM_MAX_NODES, |
| 710 | buf + out, len - out); |
| 711 | out += snprintf(buf + out, len - out, "\n"); |
| 712 | |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 713 | /* Live Map: xx xx xx */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 714 | out += snprintf(buf + out, len - out, "Live Map: "); |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 715 | out += stringify_nodemap(dlm->live_nodes_map, O2NM_MAX_NODES, |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 716 | buf + out, len - out); |
| 717 | out += snprintf(buf + out, len - out, "\n"); |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 718 | |
Sunil Mushran | e64ff14 | 2009-02-26 15:00:46 -0800 | [diff] [blame] | 719 | /* Lock Resources: xxx (xxx) */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 720 | out += snprintf(buf + out, len - out, |
Sunil Mushran | e64ff14 | 2009-02-26 15:00:46 -0800 | [diff] [blame] | 721 | "Lock Resources: %d (%d)\n", |
| 722 | atomic_read(&dlm->res_cur_count), |
| 723 | atomic_read(&dlm->res_tot_count)); |
| 724 | |
| 725 | for (i = 0; i < DLM_MLE_NUM_TYPES; ++i) |
| 726 | tot_mles += atomic_read(&dlm->mle_tot_count[i]); |
| 727 | |
| 728 | for (i = 0; i < DLM_MLE_NUM_TYPES; ++i) |
| 729 | cur_mles += atomic_read(&dlm->mle_cur_count[i]); |
| 730 | |
| 731 | /* MLEs: xxx (xxx) */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 732 | out += snprintf(buf + out, len - out, |
Sunil Mushran | e64ff14 | 2009-02-26 15:00:46 -0800 | [diff] [blame] | 733 | "MLEs: %d (%d)\n", cur_mles, tot_mles); |
| 734 | |
| 735 | /* Blocking: xxx (xxx) */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 736 | out += snprintf(buf + out, len - out, |
Sunil Mushran | e64ff14 | 2009-02-26 15:00:46 -0800 | [diff] [blame] | 737 | " Blocking: %d (%d)\n", |
| 738 | atomic_read(&dlm->mle_cur_count[DLM_MLE_BLOCK]), |
| 739 | atomic_read(&dlm->mle_tot_count[DLM_MLE_BLOCK])); |
| 740 | |
| 741 | /* Mastery: xxx (xxx) */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 742 | out += snprintf(buf + out, len - out, |
Sunil Mushran | e64ff14 | 2009-02-26 15:00:46 -0800 | [diff] [blame] | 743 | " Mastery: %d (%d)\n", |
| 744 | atomic_read(&dlm->mle_cur_count[DLM_MLE_MASTER]), |
| 745 | atomic_read(&dlm->mle_tot_count[DLM_MLE_MASTER])); |
| 746 | |
| 747 | /* Migration: xxx (xxx) */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 748 | out += snprintf(buf + out, len - out, |
Sunil Mushran | e64ff14 | 2009-02-26 15:00:46 -0800 | [diff] [blame] | 749 | " Migration: %d (%d)\n", |
| 750 | atomic_read(&dlm->mle_cur_count[DLM_MLE_MIGRATION]), |
| 751 | atomic_read(&dlm->mle_tot_count[DLM_MLE_MIGRATION])); |
| 752 | |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 753 | /* Lists: Dirty=Empty Purge=InUse PendingASTs=Empty ... */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 754 | out += snprintf(buf + out, len - out, |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 755 | "Lists: Dirty=%s Purge=%s PendingASTs=%s " |
Sunil Mushran | 2ed6c75 | 2009-02-26 15:00:41 -0800 | [diff] [blame] | 756 | "PendingBASTs=%s\n", |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 757 | (list_empty(&dlm->dirty_list) ? "Empty" : "InUse"), |
| 758 | (list_empty(&dlm->purge_list) ? "Empty" : "InUse"), |
| 759 | (list_empty(&dlm->pending_asts) ? "Empty" : "InUse"), |
Sunil Mushran | 2ed6c75 | 2009-02-26 15:00:41 -0800 | [diff] [blame] | 760 | (list_empty(&dlm->pending_basts) ? "Empty" : "InUse")); |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 761 | |
| 762 | /* Purge Count: xxx Refs: xxx */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 763 | out += snprintf(buf + out, len - out, |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 764 | "Purge Count: %d Refs: %d\n", dlm->purge_count, |
Peter Zijlstra | 2c935bc | 2016-11-14 17:29:48 +0100 | [diff] [blame] | 765 | kref_read(&dlm->dlm_refs)); |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 766 | |
| 767 | /* Dead Node: xxx */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 768 | out += snprintf(buf + out, len - out, |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 769 | "Dead Node: %d\n", dlm->reco.dead_node); |
| 770 | |
| 771 | /* What about DLM_RECO_STATE_FINALIZE? */ |
| 772 | if (dlm->reco.state == DLM_RECO_STATE_ACTIVE) |
| 773 | state = "ACTIVE"; |
| 774 | else |
| 775 | state = "INACTIVE"; |
| 776 | |
| 777 | /* Recovery Pid: xxxx Master: xxx State: xxxx */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 778 | out += snprintf(buf + out, len - out, |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 779 | "Recovery Pid: %d Master: %d State: %s\n", |
Sunil Mushran | 37096a7 | 2010-12-20 16:35:00 -0800 | [diff] [blame] | 780 | task_pid_nr(dlm->dlm_reco_thread_task), |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 781 | dlm->reco.new_master, state); |
| 782 | |
| 783 | /* Recovery Map: xx xx */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 784 | out += snprintf(buf + out, len - out, "Recovery Map: "); |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 785 | out += stringify_nodemap(dlm->recovery_map, O2NM_MAX_NODES, |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 786 | buf + out, len - out); |
| 787 | out += snprintf(buf + out, len - out, "\n"); |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 788 | |
| 789 | /* Recovery Node State: */ |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 790 | out += snprintf(buf + out, len - out, "Recovery Node State:\n"); |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 791 | list_for_each_entry(node, &dlm->reco.node_data, list) { |
| 792 | switch (node->state) { |
| 793 | case DLM_RECO_NODE_DATA_INIT: |
| 794 | state = "INIT"; |
| 795 | break; |
| 796 | case DLM_RECO_NODE_DATA_REQUESTING: |
| 797 | state = "REQUESTING"; |
| 798 | break; |
| 799 | case DLM_RECO_NODE_DATA_DEAD: |
| 800 | state = "DEAD"; |
| 801 | break; |
| 802 | case DLM_RECO_NODE_DATA_RECEIVING: |
| 803 | state = "RECEIVING"; |
| 804 | break; |
| 805 | case DLM_RECO_NODE_DATA_REQUESTED: |
| 806 | state = "REQUESTED"; |
| 807 | break; |
| 808 | case DLM_RECO_NODE_DATA_DONE: |
| 809 | state = "DONE"; |
| 810 | break; |
| 811 | case DLM_RECO_NODE_DATA_FINALIZE_SENT: |
| 812 | state = "FINALIZE-SENT"; |
| 813 | break; |
| 814 | default: |
| 815 | state = "BAD"; |
| 816 | break; |
| 817 | } |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 818 | out += snprintf(buf + out, len - out, "\t%u - %s\n", |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 819 | node->node_num, state); |
| 820 | } |
| 821 | |
| 822 | spin_unlock(&dlm->spinlock); |
| 823 | |
| 824 | return out; |
| 825 | } |
| 826 | |
| 827 | static int debug_state_open(struct inode *inode, struct file *file) |
| 828 | { |
| 829 | struct dlm_ctxt *dlm = inode->i_private; |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 830 | char *buf = NULL; |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 831 | |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 832 | buf = (char *) get_zeroed_page(GFP_NOFS); |
| 833 | if (!buf) |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 834 | goto bail; |
| 835 | |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 836 | i_size_write(inode, debug_state_print(dlm, buf, PAGE_SIZE - 1)); |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 837 | |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 838 | file->private_data = buf; |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 839 | |
| 840 | return 0; |
| 841 | bail: |
| 842 | return -ENOMEM; |
| 843 | } |
| 844 | |
Alexey Dobriyan | 828c095 | 2009-10-01 15:43:56 -0700 | [diff] [blame] | 845 | static const struct file_operations debug_state_fops = { |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 846 | .open = debug_state_open, |
Sunil Mushran | 02bd9c3 | 2010-12-20 16:34:59 -0800 | [diff] [blame] | 847 | .release = debug_release, |
| 848 | .read = debug_read, |
| 849 | .llseek = generic_file_llseek, |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 850 | }; |
| 851 | /* end - debug state funcs */ |
| 852 | |
| 853 | /* files in subroot */ |
Greg Kroah-Hartman | e581595 | 2019-07-11 20:53:12 -0700 | [diff] [blame] | 854 | void dlm_debug_init(struct dlm_ctxt *dlm) |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 855 | { |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 856 | /* for dumping dlm_ctxt */ |
Greg Kroah-Hartman | 5e7a3ed | 2019-09-23 15:33:15 -0700 | [diff] [blame] | 857 | debugfs_create_file(DLM_DEBUGFS_DLM_STATE, S_IFREG|S_IRUSR, |
| 858 | dlm->dlm_debugfs_subroot, dlm, &debug_state_fops); |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 859 | |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 860 | /* for dumping lockres */ |
Greg Kroah-Hartman | 5e7a3ed | 2019-09-23 15:33:15 -0700 | [diff] [blame] | 861 | debugfs_create_file(DLM_DEBUGFS_LOCKING_STATE, S_IFREG|S_IRUSR, |
| 862 | dlm->dlm_debugfs_subroot, dlm, &debug_lockres_fops); |
Sunil Mushran | 4e3d24e | 2008-03-10 15:16:24 -0700 | [diff] [blame] | 863 | |
Sunil Mushran | d0129ac | 2008-03-10 15:16:26 -0700 | [diff] [blame] | 864 | /* for dumping mles */ |
Greg Kroah-Hartman | 5e7a3ed | 2019-09-23 15:33:15 -0700 | [diff] [blame] | 865 | debugfs_create_file(DLM_DEBUGFS_MLE_STATE, S_IFREG|S_IRUSR, |
| 866 | dlm->dlm_debugfs_subroot, dlm, &debug_mle_fops); |
Sunil Mushran | d0129ac | 2008-03-10 15:16:26 -0700 | [diff] [blame] | 867 | |
Sunil Mushran | 7209300 | 2008-03-10 15:16:27 -0700 | [diff] [blame] | 868 | /* for dumping lockres on the purge list */ |
Greg Kroah-Hartman | 5e7a3ed | 2019-09-23 15:33:15 -0700 | [diff] [blame] | 869 | debugfs_create_file(DLM_DEBUGFS_PURGE_LIST, S_IFREG|S_IRUSR, |
| 870 | dlm->dlm_debugfs_subroot, dlm, |
| 871 | &debug_purgelist_fops); |
Sunil Mushran | 007dce5 | 2008-03-10 15:16:23 -0700 | [diff] [blame] | 872 | } |
Sunil Mushran | 6325b4a | 2008-03-10 15:16:22 -0700 | [diff] [blame] | 873 | |
| 874 | /* subroot - domain dir */ |
Greg Kroah-Hartman | 5e7a3ed | 2019-09-23 15:33:15 -0700 | [diff] [blame] | 875 | void dlm_create_debugfs_subroot(struct dlm_ctxt *dlm) |
Sunil Mushran | 6325b4a | 2008-03-10 15:16:22 -0700 | [diff] [blame] | 876 | { |
Greg Kroah-Hartman | e581595 | 2019-07-11 20:53:12 -0700 | [diff] [blame] | 877 | dlm->dlm_debugfs_subroot = debugfs_create_dir(dlm->name, |
| 878 | dlm_debugfs_root); |
Sunil Mushran | 6325b4a | 2008-03-10 15:16:22 -0700 | [diff] [blame] | 879 | } |
| 880 | |
| 881 | void dlm_destroy_debugfs_subroot(struct dlm_ctxt *dlm) |
| 882 | { |
Greg Kroah-Hartman | 5e7a3ed | 2019-09-23 15:33:15 -0700 | [diff] [blame] | 883 | debugfs_remove_recursive(dlm->dlm_debugfs_subroot); |
Sunil Mushran | 6325b4a | 2008-03-10 15:16:22 -0700 | [diff] [blame] | 884 | } |
| 885 | |
| 886 | /* debugfs root */ |
Greg Kroah-Hartman | e581595 | 2019-07-11 20:53:12 -0700 | [diff] [blame] | 887 | void dlm_create_debugfs_root(void) |
Sunil Mushran | 6325b4a | 2008-03-10 15:16:22 -0700 | [diff] [blame] | 888 | { |
| 889 | dlm_debugfs_root = debugfs_create_dir(DLM_DEBUGFS_DIR, NULL); |
Sunil Mushran | 6325b4a | 2008-03-10 15:16:22 -0700 | [diff] [blame] | 890 | } |
| 891 | |
| 892 | void dlm_destroy_debugfs_root(void) |
| 893 | { |
Sunil Mushran | 37096a7 | 2010-12-20 16:35:00 -0800 | [diff] [blame] | 894 | debugfs_remove(dlm_debugfs_root); |
Sunil Mushran | 6325b4a | 2008-03-10 15:16:22 -0700 | [diff] [blame] | 895 | } |
| 896 | #endif /* CONFIG_DEBUG_FS */ |