The patch titled revert kthread-update-loopc-to-use-kthread has been removed from the -mm tree. Its filename is revert-kthread-update-loopc-to-use-kthread.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ Subject: revert kthread-update-loopc-to-use-kthread From: Andrew Morton <akpm@xxxxxxxx> Hugh sayeth: It seems too little tested: "losetup -d /dev/loop0" fails with EINVAL because nothing sets lo_thread; but even when you patch loop_thread() to set lo->lo_thread = current, it can't survive more than a few dozen iterations of the loop below (with a tmpfs mounted on /tst): collapses with failed ioctl then BUG_ON(!bio). I think the original lo_done completion was more subtle and safe than the kthread conversion has allowed for. j=0 cp /dev/zero /tst while : do let j=j+1 echo "Doing pass $j" losetup /dev/loop0 /tst/zero mkfs -t ext2 -b 1024 /dev/loop0 >/dev/null 2>&1 mount -t ext2 /dev/loop0 /mnt umount /mnt losetup -d /dev/loop0 done Cc: Hugh Dickins <hugh@xxxxxxxxxxx> Cc: "Serge E. Hallyn" <serue@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/block/loop.c | 24 +++++++++++++----------- include/linux/loop.h | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff -puN drivers/block/loop.c~revert-kthread-update-loopc-to-use-kthread drivers/block/loop.c --- a/drivers/block/loop.c~revert-kthread-update-loopc-to-use-kthread +++ a/drivers/block/loop.c @@ -74,7 +74,6 @@ #include <linux/completion.h> #include <linux/highmem.h> #include <linux/gfp.h> -#include <linux/kthread.h> #include <asm/uaccess.h> @@ -579,6 +578,8 @@ static int loop_thread(void *data) struct loop_device *lo = data; struct bio *bio; + daemonize("loop%d", lo->lo_number); + /* * loop can be used in an encrypted device, * hence, it mustn't be stopped at all @@ -591,6 +592,11 @@ static int loop_thread(void *data) lo->lo_state = Lo_bound; lo->lo_pending = 1; + /* + * complete it, we are running + */ + complete(&lo->lo_done); + for (;;) { int pending; @@ -623,6 +629,7 @@ static int loop_thread(void *data) break; } + complete(&lo->lo_done); return 0; } @@ -739,7 +746,6 @@ static int loop_set_fd(struct loop_devic unsigned lo_blocksize; int lo_flags = 0; int error; - struct task_struct *tsk; loff_t size; /* This is safe, since we have a reference from open(). */ @@ -839,11 +845,10 @@ static int loop_set_fd(struct loop_devic set_blocksize(bdev, lo_blocksize); - tsk = kthread_run(loop_thread, lo, "loop%d", lo->lo_number); - if (IS_ERR(tsk)) { - error = PTR_ERR(tsk); + error = kernel_thread(loop_thread, lo, CLONE_KERNEL); + if (error < 0) goto out_putf; - } + wait_for_completion(&lo->lo_done); return 0; out_putf: @@ -899,9 +904,6 @@ static int loop_clr_fd(struct loop_devic if (lo->lo_state != Lo_bound) return -ENXIO; - if (!lo->lo_thread) - return -EINVAL; - if (lo->lo_refcnt > 1) /* we needed one fd for the ioctl */ return -EBUSY; @@ -915,7 +917,7 @@ static int loop_clr_fd(struct loop_devic complete(&lo->lo_bh_done); spin_unlock_irq(&lo->lo_lock); - kthread_stop(lo->lo_thread); + wait_for_completion(&lo->lo_done); lo->lo_backing_file = NULL; @@ -928,7 +930,6 @@ static int loop_clr_fd(struct loop_devic lo->lo_sizelimit = 0; lo->lo_encrypt_key_size = 0; lo->lo_flags = 0; - lo->lo_thread = NULL; memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE); memset(lo->lo_crypt_name, 0, LO_NAME_SIZE); memset(lo->lo_file_name, 0, LO_NAME_SIZE); @@ -1293,6 +1294,7 @@ static int __init loop_init(void) if (!lo->lo_queue) goto out_mem4; mutex_init(&lo->lo_ctl_mutex); + init_completion(&lo->lo_done); init_completion(&lo->lo_bh_done); lo->lo_number = i; spin_lock_init(&lo->lo_lock); diff -puN include/linux/loop.h~revert-kthread-update-loopc-to-use-kthread include/linux/loop.h --- a/include/linux/loop.h~revert-kthread-update-loopc-to-use-kthread +++ a/include/linux/loop.h @@ -59,7 +59,7 @@ struct loop_device { struct bio *lo_bio; struct bio *lo_biotail; int lo_state; - struct task_struct *lo_thread; + struct completion lo_done; struct completion lo_bh_done; struct mutex lo_ctl_mutex; int lo_pending; _ Patches currently in -mm which might be from akpm@xxxxxxxx are origin.patch pm_trace-is-bust.patch catch-notification-of-memory-add-event-of-acpi-via-container-driver-register-start-func-for-memory-device.patch catch-notification-of-memory-add-event-of-acpi-via-container-driveravoid-redundant-call-add_memory.patch disable-debugging-version-of-write_lock.patch acpi-update-asus_acpi-driver-registration-fix.patch acpi-asus-s3-resume-fix-fix.patch sony_apci-resume.patch git-agpgart.patch kauditd_thread-warning-fix.patch git-cifs.patch i2c-801-64bit-resource-fix.patch git-geode-fixup.patch git-gfs2.patch git-gfs2-fixup.patch gfs2-get_sb_dev-fix.patch revert-sparc-build-breakage.patch git-klibc.patch git-klibc-fixup.patch git-hdrcleanup-vs-git-klibc-on-ia64.patch git-hdrcleanup-vs-git-klibc-on-ia64-2.patch libata-reduce-timeouts.patch libatah-needs-scatterlisth.patch sata-is-bust-on-s390.patch forcedeth-typecast-cleanup.patch drivers-net-ns83820c-add-paramter-to-disable-auto.patch git-pcmcia-fixup.patch powerpc-kcofnig-warning-fix.patch serial-8250-sysrq-deadlock-fix.patch serial-fix-uart_bug_txen-test.patch revert-gregkh-pci-pci-test-that-drivers-properly-call-pci_set_master.patch clear-abnormal-poweroff-flag-on-via-southbridges-fix-resume-fix.patch git-scsi-misc.patch git-scsi-misc-fixup.patch areca-raid-linux-scsi-driver.patch git-scsi-target-fixup.patch git-supertrak-fixup.patch pgdat-allocation-for-new-node-add-export-kswapd-start-func-fix.patch adix-tree-rcu-lockless-readside-update-tidy.patch zoned-vm-counters-create-vmstatc-h-from-page_allocc-h-s390-fix.patch zoned-vm-counters-create-vmstatc-h-from-page_allocc-h-fix.patch zoned-vm-counters-basic-zvc-zoned-vm-counter-implementation-tidy.patch zoned-vm-counters-convert-nr_mapped-to-per-zone-counter-fix.patch zoned-vm-counters-remove-nr_file_mapped-from-scan-control-structure-fix.patch zoned-vm-counters-conversion-of-nr_slab-to-per-zone-counter-fix.patch zoned-vm-counters-conversion-of-nr_pagetables-to-per-zone-counter-fix.patch zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter-fix.patch zoned-vm-counters-conversion-of-nr_writeback-to-per-zone-counter.patch zoned-vm-counters-conversion-of-nr_writeback-to-per-zone-counter-fix.patch zoned-vm-counters-conversion-of-nr_unstable-to-per-zone-counter-nfs-fix.patch zoned-vm-counters-conversion-of-nr_unstable-to-per-zone-counter-fix.patch zoned-vm-counters-conversion-of-nr_bounce-to-per-zone-counter.patch zoned-vm-counters-conversion-of-nr_bounce-to-per-zone-counter-fix.patch zoned-vm-counters-remove-read_page_state.patch acx1xx-wireless-driver.patch tiacx-pci-build-fix.patch tiacx-ia64-fix.patch i386-moving-phys_proc_id-and-cpu_core_id-to-cpuinfo_x86-warning-fix.patch vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma-tidy.patch vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma-arch_vma_name-fix.patch vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma-vs-x86_64-mm-reliable-stack-trace-support-i386.patch vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma-vs-x86_64-mm-reliable-stack-trace-support-i386-2.patch vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma-vs-x86_64-mm-reliable-stack-trace-support-i386-2-revert-maxmem-change.patch deprecate-smbfs-in-favour-of-cifs.patch add-export_unused_symbol-and-export_unused_symbol_gpl-default.patch load_module-cleanup.patch add-receive_room-flow-control-to-flush_to_ldisc-tidy.patch srcu-rcu-variant-permitting-read-side-blocking-fixes.patch reiserfs-on-demand-bitmap-loading-fix.patch cpu-hotplug-make-cpu_notifier-related-notifier-calls-__cpuinit-only-fix-fix.patch per-task-delay-accounting-proc-export-of-aggregated-block-i-o-delays-warning-fix.patch delay-accounting-taskstats-interface-send-tgid-once-fixes.patch sched-fix-smt-nice-lock-contention-and-optimization-tidy.patch swap_prefetch-vs-zoned-counters.patch pi-futex-rt-mutex-tester-fix.patch rtmutex-propagate-priority-settings-into-pi-lock-chains-fix.patch mark-address_space_operations-const-vs-ecryptfs-mmap-operations.patch ecryptfs-alpha-build-fix.patch ecryptfs-more-elegant-aes-key-size-manipulation-tidy.patch ecryptfs-get_sb_dev-fix.patch namespaces-add-nsproxy-dont-include-compileh.patch namespaces-utsname-switch-to-using-uts-namespaces-alpha-fix.patch namespaces-utsname-use-init_utsname-when-appropriate-cifs-update.patch namespaces-utsname-implement-utsname-namespaces-export.patch namespaces-utsname-implement-utsname-namespaces-dont-include-compileh.patch namespaces-utsname-sysctl-hack-cleanup-2-fix.patch ipc-namespace-core-fix.patch task-watchers-task-watchers-tidy.patch task-watchers-add-support-for-per-task-watchers-warning-fix.patch readahead-sysctl-parameters-fix.patch make-copy_from_user_inatomic-not-zero-the-tail-on-i386-vs-reiser4.patch reiser4-hardirq-include-fix.patch reiser4-run-truncate_inode_pages-in-reiser4_delete_inode.patch reiser4-get_sb_dev-fix.patch reiser4-vs-zoned-allocator.patch hpt3xx-rework-rate-filtering-tidy.patch genirq-rename-desc-handler-to-desc-chip-power-fix.patch genirq-rename-desc-handler-to-desc-chip-ia64-fix.patch genirq-rename-desc-handler-to-desc-chip-ia64-fix-2.patch genirq-rename-desc-handler-to-desc-chip-terminate_irqs-fix.patch genirq-ia64-build-fix.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html