summaryrefslogtreecommitdiffstats
path: root/drivers/md (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'flex-array-transformations-6.3-rc1' of ↵Linus Torvalds2023-02-251-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux Pull flexible-array updates from Gustavo Silva: "Transform zero-length arrays, in unions, into flexible arrays" * tag 'flex-array-transformations-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux: bcache: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper mm/memremap: Replace zero-length array with DECLARE_FLEX_ARRAY() helper exportfs: Replace zero-length array with DECLARE_FLEX_ARRAY() helper
| * bcache: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helperGustavo A. R. Silva2023-01-061-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length arrays declarations in anonymous union with the new DECLARE_FLEX_ARRAY() helper macro. This helper allows for flexible-array members in unions. Link: https://github.com/KSPP/linux/issues/193 Link: https://github.com/KSPP/linux/issues/213 Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
* | Merge tag 'for-6.3/dm-changes' of ↵Linus Torvalds2023-02-22107-1794/+2243
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm Pull device mapper updates from Mike Snitzer: - Fix DM cache target to free background tracker work items, otherwise slab BUG will occur when kmem_cache_destroy() is called. - Improve 2 of DM's shrinker names to reflect their use. - Fix the DM flakey target to not corrupt the zero page. Fix dm-flakey on 32-bit hughmem systems by using bvec_kmap_local instead of page_address. Also, fix logic used when imposing the "corrupt_bio_byte" feature. - Stop using WQ_UNBOUND for DM verity target's verify_wq because it causes significant Android latencies on ARM64 (and doesn't show real benefit on other architectures). - Add negative check to catch simple case of a DM table referencing itself. More complex scenarios that use intermediate devices to self-reference still need to be avoided/handled in userspace. - Fix DM core's resize to only send one uevent instead of two. This fixes a race with udev, that if udev wins, will cause udev to miss uevents (which caused premature unmount attempts by systemd). - Add cond_resched() to workqueue functions in DM core, dn-thin and dm-cache so that their loops aren't the cause of unintended cpu scheduling fairness issues. - Fix all of DM's checkpatch errors and warnings (famous last words). Various other small cleanups. * tag 'for-6.3/dm-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: (62 commits) dm: remove unnecessary (void*) conversion in event_callback() dm ioctl: remove unnecessary check when using dm_get_mdptr() dm ioctl: assert _hash_lock is held in __hash_remove dm cache: add cond_resched() to various workqueue loops dm thin: add cond_resched() to various workqueue loops dm: add cond_resched() to dm_wq_requeue_work() dm: add cond_resched() to dm_wq_work() dm sysfs: make kobj_type structure constant dm: update targets using system workqueues to use a local workqueue dm: remove flush_scheduled_work() during local_exit() dm clone: prefer kvmalloc_array() dm: declare variables static when sensible dm: fix suspect indent whitespace dm ioctl: prefer strscpy() instead of strlcpy() dm: avoid void function return statements dm integrity: change macros min/max() -> min_t/max_t where appropriate dm: fix use of sizeof() macro dm: avoid 'do {} while(0)' loop in single statement macros dm log: avoid multiple line dereference dm log: avoid trailing semicolon in macro ...
| * | dm: remove unnecessary (void*) conversion in event_callback()XU pengfei2023-02-201-1/+1
| | | | | | | | | | | | | | | | | | | | | Pointer variables of void * type do not require type cast. Signed-off-by: XU pengfei <xupengfei@nfschina.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm ioctl: remove unnecessary check when using dm_get_mdptr()Hou Tao2023-02-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __hash_remove() removes hash_cell with _hash_lock locked, so acquiring _hash_lock can guarantee no-NULL hc returned from dm_get_mdptr() must have not been removed and hc->md must still be md. __hash_remove() also acquires dm_hash_cells_mutex before setting mdptr as NULL. So in dm_copy_name_and_uuid(), after acquiring dm_hash_cells_mutex and ensuring returned hc is not NULL, the returned hc must still be alive and hc->md must still be md. Remove the unnecessary hc->md != md checks when using dm_get_mdptr() with _hash_lock or dm_hash_cells_mutex acquired. Signed-off-by: Hou Tao <houtao1@huawei.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm ioctl: assert _hash_lock is held in __hash_removeMike Snitzer2023-02-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Also update dm_early_create() to take _hash_lock when calling both __get_name_cell and __hash_remove -- given dm_early_create()'s early boot usecase this locking isn't about correctness but it allows lockdep_assert_held() to be added to __hash_remove. Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm cache: add cond_resched() to various workqueue loopsMike Snitzer2023-02-171-0/+4
| | | | | | | | | | | | | | | | | | | | | Otherwise on resource constrained systems these workqueues may be too greedy. Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm thin: add cond_resched() to various workqueue loopsMike Snitzer2023-02-171-0/+2
| | | | | | | | | | | | | | | | | | | | | Otherwise on resource constrained systems these workqueues may be too greedy. Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: add cond_resched() to dm_wq_requeue_work()Mike Snitzer2023-02-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise the while() loop in dm_wq_requeue_work() can result in a "dead loop" on systems that have preemption disabled. This is particularly problematic on single cpu systems. Fixes: 8b211aaccb915 ("dm: add two stage requeue mechanism") Cc: stable@vger.kernel.org Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: add cond_resched() to dm_wq_work()Pingfan Liu2023-02-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise the while() loop in dm_wq_work() can result in a "dead loop" on systems that have preemption disabled. This is particularly problematic on single cpu systems. Cc: stable@vger.kernel.org Signed-off-by: Pingfan Liu <piliu@redhat.com> Acked-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm sysfs: make kobj_type structure constantThomas Weißschuh2023-02-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.") the driver core allows the usage of const struct kobj_type. Take advantage of this to constify the structure definition to prevent modification at runtime. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: update targets using system workqueues to use a local workqueueTetsuo Handa2023-02-143-9/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | Flushing system-wide workqueues is dangerous and will be forbidden. Use a local workqueue in dm-mpath.c, dm-raid1.c, and dm-stripe.c. Link: https://lkml.kernel.org/r/49925af7-78a8-a3dd-bce6-cfc02e1a9236@I-love.SAKURA.ne.jp Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: remove flush_scheduled_work() during local_exit()Mike Snitzer2023-02-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit acfe0ad74d2e1 ("dm: allocate a special workqueue for deferred device removal") switched from using system workqueue to a single workqueue local to DM. But it didn't eliminate the call to flush_scheduled_work() that was introduced purely for the benefit of deferred device removal with commit 2c140a246dc ("dm: allow remove to be deferred"). Since DM core uses its own workqueue (and queue_work) there is no need to call flush_scheduled_work() from local_exit(). local_exit()'s destroy_workqueue(deferred_remove_workqueue) handles flushing work started with queue_work(). Fixes: acfe0ad74d2e1 ("dm: allocate a special workqueue for deferred device removal") Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm clone: prefer kvmalloc_array()Heinz Mauelshagen2023-02-141-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: declare variables static when sensibleHeinz Mauelshagen2023-02-142-2/+2
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: fix suspect indent whitespaceHeinz Mauelshagen2023-02-142-2/+2
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm ioctl: prefer strscpy() instead of strlcpy()Heinz Mauelshagen2023-02-141-2/+2
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: avoid void function return statementsHeinz Mauelshagen2023-02-143-11/+0
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm integrity: change macros min/max() -> min_t/max_t where appropriateHeinz Mauelshagen2023-02-141-5/+5
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: fix use of sizeof() macroHeinz Mauelshagen2023-02-144-15/+15
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: avoid 'do {} while(0)' loop in single statement macrosHeinz Mauelshagen2023-02-142-5/+3
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm log: avoid multiple line dereferenceHeinz Mauelshagen2023-02-141-2/+1
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm log: avoid trailing semicolon in macroHeinz Mauelshagen2023-02-141-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm ioctl: have constant on the right side of the testHeinz Mauelshagen2023-02-141-2/+2
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: don't indent labelsHeinz Mauelshagen2023-02-144-4/+4
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: avoid inline filenamesHeinz Mauelshagen2023-02-143-5/+2
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: add missing blank line after declarations/fix thoseHeinz Mauelshagen2023-02-145-6/+11
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: avoid useless 'else' after 'break' or return'Heinz Mauelshagen2023-02-146-38/+38
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: favour __packed versus "__attribute__ ((packed))"Heinz Mauelshagen2023-02-142-6/+6
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: favour __aligned(N) versus "__attribute__ (aligned(N))"Heinz Mauelshagen2023-02-143-7/+7
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: avoid using symbolic permissionsHeinz Mauelshagen2023-02-149-23/+22
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: prefer '"%s...", __func__'Heinz Mauelshagen2023-02-1410-39/+39
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: adjust EXPORT_SYMBOL() to follow functions immediatelyHeinz Mauelshagen2023-02-144-7/+3
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: avoid split of quoted strings where possibleHeinz Mauelshagen2023-02-1412-67/+37
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: remove unnecessary braces from single statement blocksHeinz Mauelshagen2023-02-147-56/+37
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: add missing empty linesHeinz Mauelshagen2023-02-1433-27/+240
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: add argument identifier namesHeinz Mauelshagen2023-02-145-12/+12
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: avoid spaces before function arguments or in favour of tabsHeinz Mauelshagen2023-02-1414-87/+84
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm block-manager: avoid not required parenthesesHeinz Mauelshagen2023-02-141-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm crypt: correct 'foo*' to 'foo *'Heinz Mauelshagen2023-02-141-9/+9
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: fix trailing statementsHeinz Mauelshagen2023-02-148-61/+66
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: fix undue/missing spacesHeinz Mauelshagen2023-02-148-13/+12
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: correct block comments format.Heinz Mauelshagen2023-02-1423-168/+298
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: address indent/space issuesHeinz Mauelshagen2023-02-1412-25/+24
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: address space issues relative to switch/while/for/...Heinz Mauelshagen2023-02-147-12/+12
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: avoid initializing static variablesHeinz Mauelshagen2023-02-144-5/+5
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: enclose complex macros into parentheses where possibleHeinz Mauelshagen2023-02-141-2/+4
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: avoid assignment in if conditionsHeinz Mauelshagen2023-02-144-9/+17
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: change "unsigned" to "unsigned int"Heinz Mauelshagen2023-02-1476-972/+972
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
| * | dm: use fsleep() instead of msleep() for deterministic sleep durationHeinz Mauelshagen2023-02-144-10/+10
| | | | | | | | | | | | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>