Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs: dlm: remove deprecated code parts

This patch removes code parts which was declared deprecated by
commit 6b0afc0cc3e9 ("fs: dlm: don't use deprecated timeout features by
default"). This contains the following dlm functionality:

- start a cancel of a dlm request did not complete after certain timeout:
The current way how dlm cancellation works and interfering with other
dlm requests triggered by the user can end in an overlapping and
returning in -EBUSY. The most user don't handle this case and are
unaware that DLM can return such errno in such situation. Due the
timeout the user are mostly unaware when this happens.
- start a netlink warning messages for user space if dlm requests did
not complete after certain timeout:
This feature was never being built in the only known dlm user space side.
As we are to remove the timeout cancellation feature we can directly
remove this feature as well.

There might be the possibility to bring the timeout cancellation feature
back. However the current way of handling the -EBUSY case which is only
a software limitation and not a hardware limitation should be changed.
We minimize the current code base in DLM cancellation feature to not have
to deal with those existing features while solving the DLM cancellation
feature in general.

UAPI define DLM_LSFL_TIMEWARN is commented as deprecated and reserved
value. We should avoid at first to give it a new meaning but let
possible users still compile by keeping this define. In far future we
can give this flag a new meaning. The same for the DLM_LKF_TIMEOUT lock
request flag.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>

authored by

Alexander Aring and committed by
David Teigland
01c7a597 7386457a

+6 -533
-9
fs/dlm/Kconfig
··· 8 8 A general purpose distributed lock manager for kernel or userspace 9 9 applications. 10 10 11 - config DLM_DEPRECATED_API 12 - bool "DLM deprecated API" 13 - depends on DLM 14 - help 15 - Enables deprecated DLM timeout features that will be removed in 16 - later Linux kernel releases. 17 - 18 - If you are unsure, say N. 19 - 20 11 config DLM_DEBUG 21 12 bool "DLM debugging" 22 13 depends on DLM
-1
fs/dlm/Makefile
··· 17 17 requestqueue.o \ 18 18 user.o \ 19 19 util.o 20 - dlm-$(CONFIG_DLM_DEPRECATED_API) += netlink.o 21 20 dlm-$(CONFIG_DLM_DEBUG) += debug_fs.o 22 21
-21
fs/dlm/config.c
··· 75 75 unsigned int cl_log_info; 76 76 unsigned int cl_protocol; 77 77 unsigned int cl_mark; 78 - #ifdef CONFIG_DLM_DEPRECATED_API 79 - unsigned int cl_timewarn_cs; 80 - #endif 81 78 unsigned int cl_new_rsb_count; 82 79 unsigned int cl_recover_callbacks; 83 80 char cl_cluster_name[DLM_LOCKSPACE_LEN]; ··· 100 103 CLUSTER_ATTR_LOG_INFO, 101 104 CLUSTER_ATTR_PROTOCOL, 102 105 CLUSTER_ATTR_MARK, 103 - #ifdef CONFIG_DLM_DEPRECATED_API 104 - CLUSTER_ATTR_TIMEWARN_CS, 105 - #endif 106 106 CLUSTER_ATTR_NEW_RSB_COUNT, 107 107 CLUSTER_ATTR_RECOVER_CALLBACKS, 108 108 CLUSTER_ATTR_CLUSTER_NAME, ··· 220 226 CLUSTER_ATTR(log_info, NULL); 221 227 CLUSTER_ATTR(protocol, dlm_check_protocol_and_dlm_running); 222 228 CLUSTER_ATTR(mark, NULL); 223 - #ifdef CONFIG_DLM_DEPRECATED_API 224 - CLUSTER_ATTR(timewarn_cs, dlm_check_zero); 225 - #endif 226 229 CLUSTER_ATTR(new_rsb_count, NULL); 227 230 CLUSTER_ATTR(recover_callbacks, NULL); 228 231 ··· 234 243 [CLUSTER_ATTR_LOG_INFO] = &cluster_attr_log_info, 235 244 [CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol, 236 245 [CLUSTER_ATTR_MARK] = &cluster_attr_mark, 237 - #ifdef CONFIG_DLM_DEPRECATED_API 238 - [CLUSTER_ATTR_TIMEWARN_CS] = &cluster_attr_timewarn_cs, 239 - #endif 240 246 [CLUSTER_ATTR_NEW_RSB_COUNT] = &cluster_attr_new_rsb_count, 241 247 [CLUSTER_ATTR_RECOVER_CALLBACKS] = &cluster_attr_recover_callbacks, 242 248 [CLUSTER_ATTR_CLUSTER_NAME] = &cluster_attr_cluster_name, ··· 424 436 cl->cl_log_debug = dlm_config.ci_log_debug; 425 437 cl->cl_log_info = dlm_config.ci_log_info; 426 438 cl->cl_protocol = dlm_config.ci_protocol; 427 - #ifdef CONFIG_DLM_DEPRECATED_API 428 - cl->cl_timewarn_cs = dlm_config.ci_timewarn_cs; 429 - #endif 430 439 cl->cl_new_rsb_count = dlm_config.ci_new_rsb_count; 431 440 cl->cl_recover_callbacks = dlm_config.ci_recover_callbacks; 432 441 memcpy(cl->cl_cluster_name, dlm_config.ci_cluster_name, ··· 944 959 #define DEFAULT_LOG_INFO 1 945 960 #define DEFAULT_PROTOCOL DLM_PROTO_TCP 946 961 #define DEFAULT_MARK 0 947 - #ifdef CONFIG_DLM_DEPRECATED_API 948 - #define DEFAULT_TIMEWARN_CS 500 /* 5 sec = 500 centiseconds */ 949 - #endif 950 962 #define DEFAULT_NEW_RSB_COUNT 128 951 963 #define DEFAULT_RECOVER_CALLBACKS 0 952 964 #define DEFAULT_CLUSTER_NAME "" ··· 959 977 .ci_log_info = DEFAULT_LOG_INFO, 960 978 .ci_protocol = DEFAULT_PROTOCOL, 961 979 .ci_mark = DEFAULT_MARK, 962 - #ifdef CONFIG_DLM_DEPRECATED_API 963 - .ci_timewarn_cs = DEFAULT_TIMEWARN_CS, 964 - #endif 965 980 .ci_new_rsb_count = DEFAULT_NEW_RSB_COUNT, 966 981 .ci_recover_callbacks = DEFAULT_RECOVER_CALLBACKS, 967 982 .ci_cluster_name = DEFAULT_CLUSTER_NAME
-3
fs/dlm/config.h
··· 37 37 int ci_log_info; 38 38 int ci_protocol; 39 39 int ci_mark; 40 - #ifdef CONFIG_DLM_DEPRECATED_API 41 - int ci_timewarn_cs; 42 - #endif 43 40 int ci_new_rsb_count; 44 41 int ci_recover_callbacks; 45 42 char ci_cluster_name[DLM_LOCKSPACE_LEN];
-29
fs/dlm/dlm_internal.h
··· 145 145 void (*bastfn) (void *astparam, int mode); 146 146 int mode; 147 147 struct dlm_lksb *lksb; 148 - #ifdef CONFIG_DLM_DEPRECATED_API 149 - unsigned long timeout; 150 - #endif 151 148 }; 152 149 153 150 ··· 202 205 #define DLM_IFL_OVERLAP_UNLOCK 0x00080000 203 206 #define DLM_IFL_OVERLAP_CANCEL 0x00100000 204 207 #define DLM_IFL_ENDOFLIFE 0x00200000 205 - #ifdef CONFIG_DLM_DEPRECATED_API 206 - #define DLM_IFL_WATCH_TIMEWARN 0x00400000 207 - #define DLM_IFL_TIMEOUT_CANCEL 0x00800000 208 - #endif 209 208 #define DLM_IFL_DEADLOCK_CANCEL 0x01000000 210 209 #define DLM_IFL_STUB_MS 0x02000000 /* magic number for m_flags */ 211 210 ··· 258 265 struct list_head lkb_wait_reply; /* waiting for remote reply */ 259 266 struct list_head lkb_ownqueue; /* list of locks for a process */ 260 267 ktime_t lkb_timestamp; 261 - 262 - #ifdef CONFIG_DLM_DEPRECATED_API 263 - struct list_head lkb_time_list; 264 - unsigned long lkb_timeout_cs; 265 - #endif 266 268 267 269 spinlock_t lkb_cb_lock; 268 270 struct work_struct lkb_cb_work; ··· 574 586 struct mutex ls_orphans_mutex; 575 587 struct list_head ls_orphans; 576 588 577 - #ifdef CONFIG_DLM_DEPRECATED_API 578 - struct mutex ls_timeout_mutex; 579 - struct list_head ls_timeout; 580 - #endif 581 - 582 589 spinlock_t ls_new_rsb_spin; 583 590 int ls_new_rsb_count; 584 591 struct list_head ls_new_rsb; /* new rsb structs */ ··· 687 704 #define LSFL_RCOM_READY 5 688 705 #define LSFL_RCOM_WAIT 6 689 706 #define LSFL_UEVENT_WAIT 7 690 - #ifdef CONFIG_DLM_DEPRECATED_API 691 - #define LSFL_TIMEWARN 8 692 - #endif 693 707 #define LSFL_CB_DELAY 9 694 708 #define LSFL_NODIR 10 695 709 ··· 739 759 return test_bit(LSFL_NODIR, &ls->ls_flags); 740 760 } 741 761 742 - #ifdef CONFIG_DLM_DEPRECATED_API 743 - int dlm_netlink_init(void); 744 - void dlm_netlink_exit(void); 745 - void dlm_timeout_warn(struct dlm_lkb *lkb); 746 - #else 747 - static inline int dlm_netlink_init(void) { return 0; } 748 - static inline void dlm_netlink_exit(void) { }; 749 - static inline void dlm_timeout_warn(struct dlm_lkb *lkb) { }; 750 - #endif 751 762 int dlm_plock_init(void); 752 763 void dlm_plock_exit(void); 753 764
-195
fs/dlm/lock.c
··· 89 89 struct dlm_message *ms); 90 90 static int receive_extralen(struct dlm_message *ms); 91 91 static void do_purge(struct dlm_ls *ls, int nodeid, int pid); 92 - static void del_timeout(struct dlm_lkb *lkb); 93 92 static void toss_rsb(struct kref *kref); 94 93 95 94 /* ··· 291 292 if (is_master_copy(lkb)) 292 293 return; 293 294 294 - del_timeout(lkb); 295 - 296 295 DLM_ASSERT(lkb->lkb_lksb, dlm_print_lkb(lkb);); 297 - 298 - #ifdef CONFIG_DLM_DEPRECATED_API 299 - /* if the operation was a cancel, then return -DLM_ECANCEL, if a 300 - timeout caused the cancel then return -ETIMEDOUT */ 301 - if (rv == -DLM_ECANCEL && (lkb->lkb_flags & DLM_IFL_TIMEOUT_CANCEL)) { 302 - lkb->lkb_flags &= ~DLM_IFL_TIMEOUT_CANCEL; 303 - rv = -ETIMEDOUT; 304 - } 305 - #endif 306 296 307 297 if (rv == -DLM_ECANCEL && (lkb->lkb_flags & DLM_IFL_DEADLOCK_CANCEL)) { 308 298 lkb->lkb_flags &= ~DLM_IFL_DEADLOCK_CANCEL; ··· 1203 1215 kref_init(&lkb->lkb_ref); 1204 1216 INIT_LIST_HEAD(&lkb->lkb_ownqueue); 1205 1217 INIT_LIST_HEAD(&lkb->lkb_rsb_lookup); 1206 - #ifdef CONFIG_DLM_DEPRECATED_API 1207 - INIT_LIST_HEAD(&lkb->lkb_time_list); 1208 - #endif 1209 1218 INIT_LIST_HEAD(&lkb->lkb_cb_list); 1210 1219 INIT_LIST_HEAD(&lkb->lkb_callbacks); 1211 1220 spin_lock_init(&lkb->lkb_cb_lock); ··· 1719 1734 cond_resched(); 1720 1735 } 1721 1736 } 1722 - 1723 - #ifdef CONFIG_DLM_DEPRECATED_API 1724 - static void add_timeout(struct dlm_lkb *lkb) 1725 - { 1726 - struct dlm_ls *ls = lkb->lkb_resource->res_ls; 1727 - 1728 - if (is_master_copy(lkb)) 1729 - return; 1730 - 1731 - if (test_bit(LSFL_TIMEWARN, &ls->ls_flags) && 1732 - !(lkb->lkb_exflags & DLM_LKF_NODLCKWT)) { 1733 - lkb->lkb_flags |= DLM_IFL_WATCH_TIMEWARN; 1734 - goto add_it; 1735 - } 1736 - if (lkb->lkb_exflags & DLM_LKF_TIMEOUT) 1737 - goto add_it; 1738 - return; 1739 - 1740 - add_it: 1741 - DLM_ASSERT(list_empty(&lkb->lkb_time_list), dlm_print_lkb(lkb);); 1742 - mutex_lock(&ls->ls_timeout_mutex); 1743 - hold_lkb(lkb); 1744 - list_add_tail(&lkb->lkb_time_list, &ls->ls_timeout); 1745 - mutex_unlock(&ls->ls_timeout_mutex); 1746 - } 1747 - 1748 - static void del_timeout(struct dlm_lkb *lkb) 1749 - { 1750 - struct dlm_ls *ls = lkb->lkb_resource->res_ls; 1751 - 1752 - mutex_lock(&ls->ls_timeout_mutex); 1753 - if (!list_empty(&lkb->lkb_time_list)) { 1754 - list_del_init(&lkb->lkb_time_list); 1755 - unhold_lkb(lkb); 1756 - } 1757 - mutex_unlock(&ls->ls_timeout_mutex); 1758 - } 1759 - 1760 - /* FIXME: is it safe to look at lkb_exflags, lkb_flags, lkb_timestamp, and 1761 - lkb_lksb_timeout without lock_rsb? Note: we can't lock timeout_mutex 1762 - and then lock rsb because of lock ordering in add_timeout. We may need 1763 - to specify some special timeout-related bits in the lkb that are just to 1764 - be accessed under the timeout_mutex. */ 1765 - 1766 - void dlm_scan_timeout(struct dlm_ls *ls) 1767 - { 1768 - struct dlm_rsb *r; 1769 - struct dlm_lkb *lkb = NULL, *iter; 1770 - int do_cancel, do_warn; 1771 - s64 wait_us; 1772 - 1773 - for (;;) { 1774 - if (dlm_locking_stopped(ls)) 1775 - break; 1776 - 1777 - do_cancel = 0; 1778 - do_warn = 0; 1779 - mutex_lock(&ls->ls_timeout_mutex); 1780 - list_for_each_entry(iter, &ls->ls_timeout, lkb_time_list) { 1781 - 1782 - wait_us = ktime_to_us(ktime_sub(ktime_get(), 1783 - iter->lkb_timestamp)); 1784 - 1785 - if ((iter->lkb_exflags & DLM_LKF_TIMEOUT) && 1786 - wait_us >= (iter->lkb_timeout_cs * 10000)) 1787 - do_cancel = 1; 1788 - 1789 - if ((iter->lkb_flags & DLM_IFL_WATCH_TIMEWARN) && 1790 - wait_us >= dlm_config.ci_timewarn_cs * 10000) 1791 - do_warn = 1; 1792 - 1793 - if (!do_cancel && !do_warn) 1794 - continue; 1795 - hold_lkb(iter); 1796 - lkb = iter; 1797 - break; 1798 - } 1799 - mutex_unlock(&ls->ls_timeout_mutex); 1800 - 1801 - if (!lkb) 1802 - break; 1803 - 1804 - r = lkb->lkb_resource; 1805 - hold_rsb(r); 1806 - lock_rsb(r); 1807 - 1808 - if (do_warn) { 1809 - /* clear flag so we only warn once */ 1810 - lkb->lkb_flags &= ~DLM_IFL_WATCH_TIMEWARN; 1811 - if (!(lkb->lkb_exflags & DLM_LKF_TIMEOUT)) 1812 - del_timeout(lkb); 1813 - dlm_timeout_warn(lkb); 1814 - } 1815 - 1816 - if (do_cancel) { 1817 - log_debug(ls, "timeout cancel %x node %d %s", 1818 - lkb->lkb_id, lkb->lkb_nodeid, r->res_name); 1819 - lkb->lkb_flags &= ~DLM_IFL_WATCH_TIMEWARN; 1820 - lkb->lkb_flags |= DLM_IFL_TIMEOUT_CANCEL; 1821 - del_timeout(lkb); 1822 - _cancel_lock(r, lkb); 1823 - } 1824 - 1825 - unlock_rsb(r); 1826 - unhold_rsb(r); 1827 - dlm_put_lkb(lkb); 1828 - } 1829 - } 1830 - 1831 - /* This is only called by dlm_recoverd, and we rely on dlm_ls_stop() stopping 1832 - dlm_recoverd before checking/setting ls_recover_begin. */ 1833 - 1834 - void dlm_adjust_timeouts(struct dlm_ls *ls) 1835 - { 1836 - struct dlm_lkb *lkb; 1837 - u64 adj_us = jiffies_to_usecs(jiffies - ls->ls_recover_begin); 1838 - 1839 - ls->ls_recover_begin = 0; 1840 - mutex_lock(&ls->ls_timeout_mutex); 1841 - list_for_each_entry(lkb, &ls->ls_timeout, lkb_time_list) 1842 - lkb->lkb_timestamp = ktime_add_us(lkb->lkb_timestamp, adj_us); 1843 - mutex_unlock(&ls->ls_timeout_mutex); 1844 - } 1845 - #else 1846 - static void add_timeout(struct dlm_lkb *lkb) { } 1847 - static void del_timeout(struct dlm_lkb *lkb) { } 1848 - #endif 1849 1737 1850 1738 /* lkb is master or local copy */ 1851 1739 ··· 2581 2723 } 2582 2724 } 2583 2725 2584 - #ifdef CONFIG_DLM_DEPRECATED_API 2585 - static int set_lock_args(int mode, struct dlm_lksb *lksb, uint32_t flags, 2586 - int namelen, unsigned long timeout_cs, 2587 - void (*ast) (void *astparam), 2588 - void *astparam, 2589 - void (*bast) (void *astparam, int mode), 2590 - struct dlm_args *args) 2591 - #else 2592 2726 static int set_lock_args(int mode, struct dlm_lksb *lksb, uint32_t flags, 2593 2727 int namelen, void (*ast)(void *astparam), 2594 2728 void *astparam, 2595 2729 void (*bast)(void *astparam, int mode), 2596 2730 struct dlm_args *args) 2597 - #endif 2598 2731 { 2599 2732 int rv = -EINVAL; 2600 2733 ··· 2638 2789 args->astfn = ast; 2639 2790 args->astparam = astparam; 2640 2791 args->bastfn = bast; 2641 - #ifdef CONFIG_DLM_DEPRECATED_API 2642 - args->timeout = timeout_cs; 2643 - #endif 2644 2792 args->mode = mode; 2645 2793 args->lksb = lksb; 2646 2794 rv = 0; ··· 2693 2847 lkb->lkb_lksb = args->lksb; 2694 2848 lkb->lkb_lvbptr = args->lksb->sb_lvbptr; 2695 2849 lkb->lkb_ownpid = (int) current->pid; 2696 - #ifdef CONFIG_DLM_DEPRECATED_API 2697 - lkb->lkb_timeout_cs = args->timeout; 2698 - #endif 2699 2850 rv = 0; 2700 2851 out: 2701 2852 switch (rv) { ··· 2777 2934 if (is_overlap(lkb)) 2778 2935 goto out; 2779 2936 2780 - /* don't let scand try to do a cancel */ 2781 - del_timeout(lkb); 2782 - 2783 2937 if (lkb->lkb_flags & DLM_IFL_RESEND) { 2784 2938 lkb->lkb_flags |= DLM_IFL_OVERLAP_CANCEL; 2785 2939 rv = -EBUSY; ··· 2814 2974 2815 2975 if (is_overlap_unlock(lkb)) 2816 2976 goto out; 2817 - 2818 - /* don't let scand try to do a cancel */ 2819 - del_timeout(lkb); 2820 2977 2821 2978 if (lkb->lkb_flags & DLM_IFL_RESEND) { 2822 2979 lkb->lkb_flags |= DLM_IFL_OVERLAP_UNLOCK; ··· 2882 3045 if (can_be_queued(lkb)) { 2883 3046 error = -EINPROGRESS; 2884 3047 add_lkb(r, lkb, DLM_LKSTS_WAITING); 2885 - add_timeout(lkb); 2886 3048 goto out; 2887 3049 } 2888 3050 ··· 2950 3114 error = -EINPROGRESS; 2951 3115 del_lkb(r, lkb); 2952 3116 add_lkb(r, lkb, DLM_LKSTS_CONVERT); 2953 - add_timeout(lkb); 2954 3117 goto out; 2955 3118 } 2956 3119 ··· 3236 3401 3237 3402 trace_dlm_lock_start(ls, lkb, name, namelen, mode, flags); 3238 3403 3239 - #ifdef CONFIG_DLM_DEPRECATED_API 3240 - error = set_lock_args(mode, lksb, flags, namelen, 0, ast, 3241 - astarg, bast, &args); 3242 - #else 3243 3404 error = set_lock_args(mode, lksb, flags, namelen, ast, astarg, bast, 3244 3405 &args); 3245 - #endif 3246 3406 if (error) 3247 3407 goto out_put; 3248 3408 ··· 4284 4454 munge_altmode(lkb, ms); 4285 4455 if (result) { 4286 4456 add_lkb(r, lkb, DLM_LKSTS_WAITING); 4287 - add_timeout(lkb); 4288 4457 } else { 4289 4458 grant_lock_pc(r, lkb, ms); 4290 4459 queue_cast(r, lkb, 0); ··· 4370 4541 munge_demoted(lkb); 4371 4542 del_lkb(r, lkb); 4372 4543 add_lkb(r, lkb, DLM_LKSTS_CONVERT); 4373 - add_timeout(lkb); 4374 4544 break; 4375 4545 4376 4546 case 0: ··· 5536 5708 return 0; 5537 5709 } 5538 5710 5539 - #ifdef CONFIG_DLM_DEPRECATED_API 5540 - int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua, 5541 - int mode, uint32_t flags, void *name, unsigned int namelen, 5542 - unsigned long timeout_cs) 5543 - #else 5544 5711 int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua, 5545 5712 int mode, uint32_t flags, void *name, unsigned int namelen) 5546 - #endif 5547 5713 { 5548 5714 struct dlm_lkb *lkb; 5549 5715 struct dlm_args args; ··· 5562 5740 goto out_put; 5563 5741 } 5564 5742 } 5565 - #ifdef CONFIG_DLM_DEPRECATED_API 5566 - error = set_lock_args(mode, &ua->lksb, flags, namelen, timeout_cs, 5567 - fake_astfn, ua, fake_bastfn, &args); 5568 - #else 5569 5743 error = set_lock_args(mode, &ua->lksb, flags, namelen, fake_astfn, ua, 5570 5744 fake_bastfn, &args); 5571 - #endif 5572 5745 if (error) { 5573 5746 kfree(ua->lksb.sb_lvbptr); 5574 5747 ua->lksb.sb_lvbptr = NULL; ··· 5605 5788 return error; 5606 5789 } 5607 5790 5608 - #ifdef CONFIG_DLM_DEPRECATED_API 5609 - int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, 5610 - int mode, uint32_t flags, uint32_t lkid, char *lvb_in, 5611 - unsigned long timeout_cs) 5612 - #else 5613 5791 int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, 5614 5792 int mode, uint32_t flags, uint32_t lkid, char *lvb_in) 5615 - #endif 5616 5793 { 5617 5794 struct dlm_lkb *lkb; 5618 5795 struct dlm_args args; ··· 5643 5832 ua->bastaddr = ua_tmp->bastaddr; 5644 5833 ua->user_lksb = ua_tmp->user_lksb; 5645 5834 5646 - #ifdef CONFIG_DLM_DEPRECATED_API 5647 - error = set_lock_args(mode, &ua->lksb, flags, 0, timeout_cs, 5648 - fake_astfn, ua, fake_bastfn, &args); 5649 - #else 5650 5835 error = set_lock_args(mode, &ua->lksb, flags, 0, fake_astfn, ua, 5651 5836 fake_bastfn, &args); 5652 - #endif 5653 5837 if (error) 5654 5838 goto out_put; 5655 5839 ··· 5961 6155 lkb = del_proc_lock(ls, proc); 5962 6156 if (!lkb) 5963 6157 break; 5964 - del_timeout(lkb); 5965 6158 if (lkb->lkb_exflags & DLM_LKF_PERSISTENT) 5966 6159 orphan_proc_lock(ls, lkb); 5967 6160 else
-17
fs/dlm/lock.h
··· 25 25 int dlm_lock_recovery_try(struct dlm_ls *ls); 26 26 void dlm_unlock_recovery(struct dlm_ls *ls); 27 27 28 - #ifdef CONFIG_DLM_DEPRECATED_API 29 - void dlm_scan_timeout(struct dlm_ls *ls); 30 - void dlm_adjust_timeouts(struct dlm_ls *ls); 31 - #else 32 - static inline void dlm_scan_timeout(struct dlm_ls *ls) { } 33 - static inline void dlm_adjust_timeouts(struct dlm_ls *ls) { } 34 - #endif 35 - 36 28 int dlm_master_lookup(struct dlm_ls *ls, int nodeid, char *name, int len, 37 29 unsigned int flags, int *r_nodeid, int *result); 38 30 ··· 39 47 int dlm_recover_master_copy(struct dlm_ls *ls, struct dlm_rcom *rc); 40 48 int dlm_recover_process_copy(struct dlm_ls *ls, struct dlm_rcom *rc); 41 49 42 - #ifdef CONFIG_DLM_DEPRECATED_API 43 - int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua, int mode, 44 - uint32_t flags, void *name, unsigned int namelen, 45 - unsigned long timeout_cs); 46 - int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, 47 - int mode, uint32_t flags, uint32_t lkid, char *lvb_in, 48 - unsigned long timeout_cs); 49 - #else 50 50 int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua, int mode, 51 51 uint32_t flags, void *name, unsigned int namelen); 52 52 int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, 53 53 int mode, uint32_t flags, uint32_t lkid, char *lvb_in); 54 - #endif 55 54 int dlm_user_adopt_orphan(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, 56 55 int mode, uint32_t flags, void *name, unsigned int namelen, 57 56 uint32_t *lkid);
-23
fs/dlm/lockspace.c
··· 273 273 if (dlm_lock_recovery_try(ls)) { 274 274 ls->ls_scan_time = jiffies; 275 275 dlm_scan_rsbs(ls); 276 - dlm_scan_timeout(ls); 277 276 dlm_unlock_recovery(ls); 278 277 } else { 279 278 ls->ls_scan_time += HZ; ··· 487 488 ls->ls_ops_arg = ops_arg; 488 489 } 489 490 490 - #ifdef CONFIG_DLM_DEPRECATED_API 491 - if (flags & DLM_LSFL_TIMEWARN) { 492 - pr_warn_once("===============================================================\n" 493 - "WARNING: the dlm DLM_LSFL_TIMEWARN flag is being deprecated and\n" 494 - " will be removed in v6.2!\n" 495 - " Inclusive DLM_LSFL_TIMEWARN define in UAPI header!\n" 496 - "===============================================================\n"); 497 - 498 - set_bit(LSFL_TIMEWARN, &ls->ls_flags); 499 - } 500 - 501 - /* ls_exflags are forced to match among nodes, and we don't 502 - * need to require all nodes to have some flags set 503 - */ 504 - ls->ls_exflags = (flags & ~(DLM_LSFL_TIMEWARN | DLM_LSFL_FS | 505 - DLM_LSFL_NEWEXCL)); 506 - #else 507 491 /* ls_exflags are forced to match among nodes, and we don't 508 492 * need to require all nodes to have some flags set 509 493 */ 510 494 ls->ls_exflags = (flags & ~(DLM_LSFL_FS | DLM_LSFL_NEWEXCL)); 511 - #endif 512 495 513 496 size = READ_ONCE(dlm_config.ci_rsbtbl_size); 514 497 ls->ls_rsbtbl_size = size; ··· 518 537 mutex_init(&ls->ls_waiters_mutex); 519 538 INIT_LIST_HEAD(&ls->ls_orphans); 520 539 mutex_init(&ls->ls_orphans_mutex); 521 - #ifdef CONFIG_DLM_DEPRECATED_API 522 - INIT_LIST_HEAD(&ls->ls_timeout); 523 - mutex_init(&ls->ls_timeout_mutex); 524 - #endif 525 540 526 541 INIT_LIST_HEAD(&ls->ls_new_rsb); 527 542 spin_lock_init(&ls->ls_new_rsb_spin);
+1 -8
fs/dlm/main.c
··· 46 46 if (error) 47 47 goto out_debug; 48 48 49 - error = dlm_netlink_init(); 50 - if (error) 51 - goto out_user; 52 - 53 49 error = dlm_plock_init(); 54 50 if (error) 55 - goto out_netlink; 51 + goto out_user; 56 52 57 53 printk("DLM installed\n"); 58 54 59 55 return 0; 60 56 61 - out_netlink: 62 - dlm_netlink_exit(); 63 57 out_user: 64 58 dlm_user_exit(); 65 59 out_debug: ··· 71 77 static void __exit exit_dlm(void) 72 78 { 73 79 dlm_plock_exit(); 74 - dlm_netlink_exit(); 75 80 dlm_user_exit(); 76 81 dlm_config_exit(); 77 82 dlm_memory_exit();
-139
fs/dlm/netlink.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Copyright (C) 2007 Red Hat, Inc. All rights reserved. 4 - */ 5 - 6 - #include <net/genetlink.h> 7 - #include <linux/dlm.h> 8 - #include <linux/dlm_netlink.h> 9 - #include <linux/gfp.h> 10 - 11 - #include "dlm_internal.h" 12 - 13 - static uint32_t dlm_nl_seqnum; 14 - static uint32_t listener_nlportid; 15 - 16 - static struct genl_family family; 17 - 18 - static int prepare_data(u8 cmd, struct sk_buff **skbp, size_t size) 19 - { 20 - struct sk_buff *skb; 21 - void *data; 22 - 23 - skb = genlmsg_new(size, GFP_NOFS); 24 - if (!skb) 25 - return -ENOMEM; 26 - 27 - /* add the message headers */ 28 - data = genlmsg_put(skb, 0, dlm_nl_seqnum++, &family, 0, cmd); 29 - if (!data) { 30 - nlmsg_free(skb); 31 - return -EINVAL; 32 - } 33 - 34 - *skbp = skb; 35 - return 0; 36 - } 37 - 38 - static struct dlm_lock_data *mk_data(struct sk_buff *skb) 39 - { 40 - struct nlattr *ret; 41 - 42 - ret = nla_reserve(skb, DLM_TYPE_LOCK, sizeof(struct dlm_lock_data)); 43 - if (!ret) 44 - return NULL; 45 - return nla_data(ret); 46 - } 47 - 48 - static int send_data(struct sk_buff *skb) 49 - { 50 - struct genlmsghdr *genlhdr = nlmsg_data((struct nlmsghdr *)skb->data); 51 - void *data = genlmsg_data(genlhdr); 52 - 53 - genlmsg_end(skb, data); 54 - 55 - return genlmsg_unicast(&init_net, skb, listener_nlportid); 56 - } 57 - 58 - static int user_cmd(struct sk_buff *skb, struct genl_info *info) 59 - { 60 - listener_nlportid = info->snd_portid; 61 - printk("user_cmd nlpid %u\n", listener_nlportid); 62 - return 0; 63 - } 64 - 65 - static const struct genl_small_ops dlm_nl_ops[] = { 66 - { 67 - .cmd = DLM_CMD_HELLO, 68 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 69 - .doit = user_cmd, 70 - }, 71 - }; 72 - 73 - static struct genl_family family __ro_after_init = { 74 - .name = DLM_GENL_NAME, 75 - .version = DLM_GENL_VERSION, 76 - .small_ops = dlm_nl_ops, 77 - .n_small_ops = ARRAY_SIZE(dlm_nl_ops), 78 - .resv_start_op = DLM_CMD_HELLO + 1, 79 - .module = THIS_MODULE, 80 - }; 81 - 82 - int __init dlm_netlink_init(void) 83 - { 84 - return genl_register_family(&family); 85 - } 86 - 87 - void dlm_netlink_exit(void) 88 - { 89 - genl_unregister_family(&family); 90 - } 91 - 92 - static void fill_data(struct dlm_lock_data *data, struct dlm_lkb *lkb) 93 - { 94 - struct dlm_rsb *r = lkb->lkb_resource; 95 - 96 - memset(data, 0, sizeof(struct dlm_lock_data)); 97 - 98 - data->version = DLM_LOCK_DATA_VERSION; 99 - data->nodeid = lkb->lkb_nodeid; 100 - data->ownpid = lkb->lkb_ownpid; 101 - data->id = lkb->lkb_id; 102 - data->remid = lkb->lkb_remid; 103 - data->status = lkb->lkb_status; 104 - data->grmode = lkb->lkb_grmode; 105 - data->rqmode = lkb->lkb_rqmode; 106 - if (lkb->lkb_ua) 107 - data->xid = lkb->lkb_ua->xid; 108 - if (r) { 109 - data->lockspace_id = r->res_ls->ls_global_id; 110 - data->resource_namelen = r->res_length; 111 - memcpy(data->resource_name, r->res_name, r->res_length); 112 - } 113 - } 114 - 115 - void dlm_timeout_warn(struct dlm_lkb *lkb) 116 - { 117 - struct sk_buff *send_skb; 118 - struct dlm_lock_data *data; 119 - size_t size; 120 - int rv; 121 - 122 - size = nla_total_size(sizeof(struct dlm_lock_data)) + 123 - nla_total_size(0); /* why this? */ 124 - 125 - rv = prepare_data(DLM_CMD_TIMEOUT, &send_skb, size); 126 - if (rv < 0) 127 - return; 128 - 129 - data = mk_data(send_skb); 130 - if (!data) { 131 - nlmsg_free(send_skb); 132 - return; 133 - } 134 - 135 - fill_data(data, lkb); 136 - 137 - send_data(send_skb); 138 - } 139 -
-2
fs/dlm/recoverd.c
··· 214 214 215 215 dlm_clear_members_gone(ls); 216 216 217 - dlm_adjust_timeouts(ls); 218 - 219 217 dlm_callback_resume(ls); 220 218 221 219 error = enable_locking(ls, rv->seq);
-22
fs/dlm/user.c
··· 259 259 goto out; 260 260 } 261 261 262 - #ifdef CONFIG_DLM_DEPRECATED_API 263 - if (params->timeout) 264 - pr_warn_once("========================================================\n" 265 - "WARNING: the lkb timeout feature is being deprecated and\n" 266 - " will be removed in v6.2!\n" 267 - "========================================================\n"); 268 - #endif 269 - 270 262 ua = kzalloc(sizeof(struct dlm_user_args), GFP_NOFS); 271 263 if (!ua) 272 264 goto out; ··· 271 279 ua->xid = params->xid; 272 280 273 281 if (params->flags & DLM_LKF_CONVERT) { 274 - #ifdef CONFIG_DLM_DEPRECATED_API 275 - error = dlm_user_convert(ls, ua, 276 - params->mode, params->flags, 277 - params->lkid, params->lvb, 278 - (unsigned long) params->timeout); 279 - #else 280 282 error = dlm_user_convert(ls, ua, 281 283 params->mode, params->flags, 282 284 params->lkid, params->lvb); 283 - #endif 284 285 } else if (params->flags & DLM_LKF_ORPHAN) { 285 286 error = dlm_user_adopt_orphan(ls, ua, 286 287 params->mode, params->flags, ··· 282 297 if (!error) 283 298 error = lkid; 284 299 } else { 285 - #ifdef CONFIG_DLM_DEPRECATED_API 286 - error = dlm_user_request(ls, ua, 287 - params->mode, params->flags, 288 - params->name, params->namelen, 289 - (unsigned long) params->timeout); 290 - #else 291 300 error = dlm_user_request(ls, ua, 292 301 params->mode, params->flags, 293 302 params->name, params->namelen); 294 - #endif 295 303 if (!error) 296 304 error = ua->lksb.sb_lkid; 297 305 }
-3
include/linux/dlm.h
··· 53 53 * The dlm should not use a resource directory, but statically assign 54 54 * resource mastery to nodes based on the name hash that is otherwise 55 55 * used to select the directory node. Must be the same on all nodes. 56 - * DLM_LSFL_TIMEWARN 57 - * The dlm should emit netlink messages if locks have been waiting 58 - * for a configurable amount of time. (Unused.) 59 56 * DLM_LSFL_NEWEXCL 60 57 * dlm_new_lockspace() should return -EEXIST if the lockspace exists. 61 58 *
+1
include/uapi/linux/dlm.h
··· 68 68 69 69 /* dlm_new_lockspace() flags */ 70 70 71 + /* DLM_LSFL_TIMEWARN is deprecated and reserved. DO NOT USE! */ 71 72 #define DLM_LSFL_TIMEWARN 0x00000002 72 73 #define DLM_LSFL_NEWEXCL 0x00000008 73 74
-60
include/uapi/linux/dlm_netlink.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - /* 3 - * Copyright (C) 2007 Red Hat, Inc. All rights reserved. 4 - * 5 - * This copyrighted material is made available to anyone wishing to use, 6 - * modify, copy, or redistribute it subject to the terms and conditions 7 - * of the GNU General Public License v.2. 8 - */ 9 - 10 - #ifndef _DLM_NETLINK_H 11 - #define _DLM_NETLINK_H 12 - 13 - #include <linux/types.h> 14 - #include <linux/dlmconstants.h> 15 - 16 - enum { 17 - DLM_STATUS_WAITING = 1, 18 - DLM_STATUS_GRANTED = 2, 19 - DLM_STATUS_CONVERT = 3, 20 - }; 21 - 22 - #define DLM_LOCK_DATA_VERSION 1 23 - 24 - struct dlm_lock_data { 25 - __u16 version; 26 - __u32 lockspace_id; 27 - int nodeid; 28 - int ownpid; 29 - __u32 id; 30 - __u32 remid; 31 - __u64 xid; 32 - __s8 status; 33 - __s8 grmode; 34 - __s8 rqmode; 35 - unsigned long timestamp; 36 - int resource_namelen; 37 - char resource_name[DLM_RESNAME_MAXLEN]; 38 - }; 39 - 40 - enum { 41 - DLM_CMD_UNSPEC = 0, 42 - DLM_CMD_HELLO, /* user->kernel */ 43 - DLM_CMD_TIMEOUT, /* kernel->user */ 44 - __DLM_CMD_MAX, 45 - }; 46 - 47 - #define DLM_CMD_MAX (__DLM_CMD_MAX - 1) 48 - 49 - enum { 50 - DLM_TYPE_UNSPEC = 0, 51 - DLM_TYPE_LOCK, 52 - __DLM_TYPE_MAX, 53 - }; 54 - 55 - #define DLM_TYPE_MAX (__DLM_TYPE_MAX - 1) 56 - 57 - #define DLM_GENL_VERSION 0x1 58 - #define DLM_GENL_NAME "DLM" 59 - 60 - #endif /* _DLM_NETLINK_H */
+4 -1
include/uapi/linux/dlmconstants.h
··· 87 87 * DLM_LKF_NODLCKWT 88 88 * 89 89 * Do not cancel the lock if it gets into conversion deadlock. 90 - * Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN. 91 90 * 92 91 * DLM_LKF_NODLCKBLK 93 92 * ··· 130 131 * 131 132 * Unlock the lock even if it is converting or waiting or has sublocks. 132 133 * Only really for use by the userland device.c code. 134 + * 135 + * DLM_LKF_TIMEOUT 136 + * 137 + * This value is deprecated and reserved. DO NOT USE! 133 138 * 134 139 */ 135 140