dect
/
linux-2.6
Archived
13
0
Fork 0
Commit Graph

135998 Commits

Author SHA1 Message Date
Felix Beck feed9b62da [S390] Add zcrypt section in MAINTAINERS
Add zcrypt section in S390 part of MAINTAINERS file.

Signed-off-by: Felix Beck <felix.beck@de.ibm.com>
Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:19 +01:00
Gerald Schaefer 4b2a8b6043 [S390] kernel: Disable switch_amode by default
Disable switch_amode by default because pagetable walk on pre z9
hardware has negative performance impact.

Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:18 +01:00
Martin Schwidefsky 8283cb43ab [S390] clock sync mode flags
The clock sync mode flag CLOCK_SYNC_STP is not cleared when stp
is set offline. In this case the get_sync_clock() function returns
-EACCESS and the dasd driver will block all i/o until stp is enabled
again. In addition get_sync_clock can return -EACCESS if the clock is
not in sync instead of -EAGAIN.

Rework the stp/etr online handling to fix these problems.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:18 +01:00
Peter Oberparleiter 56e25e9777 [S390] cio: prevent workqueue deadlock
Subchannel reprobing can block the kslowcrw workqueue indefinitely
while waiting for device recognition to finish which is also scheduled
to run on kslowcrw. Prevent this deadlock by moving the waiting
portion of subchannel reprobing to the cio workqueue.

Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:18 +01:00
Sebastian Ott 0cc110651b [S390] cio: remove unused local variable
Remove unused subchannel pointer in io_subchannel_recog_done.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:17 +01:00
Peter Oberparleiter 7a968f0565 [S390] cio: incorrect status check in interrogate function
Fix incorrect check for active I/O in interrogate function.

Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:17 +01:00
Sebastian Ott 17e7d87d9f [S390] cio: fix rc generation after chsc call
In some situations a rc in __chsc_do_secm will be overwritten
by another one. This shouldn't do harm since todays callers
don't check for _specific_ errors but fix it for the sake of
correctness.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:16 +01:00
Sebastian Ott 94cbc203be [S390] cio: fix wrong buffer access in cio_ignore_write
Writing only spaces to /proc/cio_ignore will cause a buffer overflow
since the size_t value i will not become negative and so buf[-1UL] is
accessed. Change the value of i to ssize_t.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:16 +01:00
Sebastian Ott e909074bb9 [S390] cio: ccw group fix unbind behaviour.
For a ccw group device unbinding it from its driver should do the
same as a call to ungroup, since this virtual device can not exist
without a driver.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:16 +01:00
Sebastian Ott 50f1548399 [S390] cio: fix sanity checks in ccwgroup driver.
Some sanity checks in the ccw group driver test the output of
container_of macros to be !NULL. Test the input parameters instead.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:15 +01:00
Sebastian Ott 40c9f9992b [S390] cio: ccw group online store - report rcs to the caller.
In case the ccw group driver refuses to set a device [on|off]line,
we should transmit the return code to the caller.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:15 +01:00
Sebastian Ott a1f640734a [S390] cio: airq - fix array boundary
MAX_ISC is a valid isc number, so arrays with an index of isc
need to have a length of MAX_ISC+1

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:14 +01:00
Sebastian Ott 90ac24a5ae [S390] cio: device scan oom fallback.
Since some callers rely on for_each_subchannel_staged to not fail,
fall back to brute force scanning using get_subchannel_by_schid in
case of a oom situation.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:14 +01:00
Heiko Carstens 87fa5af80c [S390] cio: ensure single load of irq handler pointer
Add barrier to prevent compiler from reloading pointer to irq handler.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:14 +01:00
Heiko Carstens 98c1c68252 [S390] cio/crw: add/fix locking
The crw_unregister_handler uses xchg + synchronize_sched when
unregistering a crw_handler.
This doesn't protect crw_collect_info to potentially jump to NULL since
it has unlocked code like this:

if (crw_handlers[i])
        crw_handlers[i](NULL, NULL, 1);

So add a mutex which protects the crw handler array for changes.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:13 +01:00
Sebastian Ott e74fe0cec9 [S390] cio: ccw device online store - report rc from ccw driver.
In case the ccw driver refuses to set a device offline, we should
transmit the return code to the caller.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:13 +01:00
Cornelia Huck c08f294a14 [S390] cio: Use ccw_device_set_notoper().
Use ccw_device_set_notoper() (which also deletes the device
timer and disables the subchannel) instead of simply setting
the state to DEV_STATE_NOT_OPER in the generic not operational
handling code. This prevents unexpected interrupts popping up
for devices that are deemed not operational.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:13 +01:00
Cornelia Huck ed04b892e2 [S390] cio: Try harder to disable subchannel.
Acting upon the assumption that cio_disable_subchannel()
is only called when we really want to disable the subchannel
(a) remove the check for activity (it is already done in
    ccw_device_offline(), which is the place where it matters)
(b) collect pending status via tsch() and ignore it (it
    can't matter anymore since the subchannel will be disabled).

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:12 +01:00
Cornelia Huck eb32ae8d0e [S390] cio: Use unbind/bind instead of unregister/register.
The common I/O layer may encounter a situation where the
device number of a ccw device has changed or a device
driver doesn't want to keep a formerly disconnected device
becoming operational again. Instead of using device_del()/
device_add() as now, we can just unbind the driver from the
device and rebind it to get the desired effect (rebinding)
with less overhead.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:12 +01:00
Heiko Carstens 1485c5c884 [S390] move EXPORT_SYMBOLs to definitions
Move all EXPORT_SYMBOLs to their corresponding definitions.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:11 +01:00
Heiko Carstens e3dd9c2da6 [S390] convert bitmap definitions to C
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:11 +01:00
Heiko Carstens 7b886416df [S390] Remove CONFIG_MACHCHK_WARNING.
Everybody enables it so there is no point for an extra config option.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:11 +01:00
Heiko Carstens f5daba1d41 [S390] split/move machine check handler code
Split machine check handler code and move it to cio and kernel code
where it belongs to. No functional change.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:10 +01:00
Sachin Sant 70193af918 [S390] Fix appldata build break with !NET
With CONFIG_NET not set appldata build breaks on s390.

arch/s390/appldata/built-in.o: In function appldata_get_net_sum_data:
appldata_net_sum.c:(.text+0x2684): undefined reference to dev_get_stats
appldata_net_sum.c:(.text+0x2688): undefined reference to init_net
appldata_net_sum.c:(.text+0x268c): undefined reference to init_net
appldata_net_sum.c:(.text+0x2694): undefined reference to dev_base_lock

The following patch fixes the issue for me.

Signed-off-by: Sachin Sant <sachinp@in.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:10 +01:00
Heiko Carstens cc54c1e66e [S390] ftrace: dont trace machine check handler
The ftrace code is currently not reentrant, so we better don't trace
our machine check handler. Machine checks are handled like NMIs on s390.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:09 +01:00
Christian Borntraeger 92e6ecf392 [S390] Fix hypervisor detection for KVM
Currently we use the cpuid (via STIDP instruction) to recognize LPAR,
z/VM and KVM.
The architecture states, that bit 0-7 of STIDP returns all zero, and
if STIDP is executed in a virtual machine, the VM operating system
will replace bits 0-7 with FF.

KVM should not use FE to distinguish z/VM from KVM for interested
guests. The proper way to detect the hypervisor is the STSI (Store
System Information) instruction, which return information about the
hypervisors via function code 3, selector1=2, selector2=2.

This patch changes the detection routine of Linux to use STSI instead
of STIDP. This detection is earlier than bootmem, we have to use a
static buffer. Since STSI expects a 4kb block (4kb aligned) this
patch also changes the init.data alignment for s390. As this section
will be freed during boot, this should be no problem.

Patch is tested with LPAR, z/VM, KVM on LPAR, and KVM under z/VM.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:09 +01:00
Carsten Otte 702d9e584f [S390] check addressing mode in s390_enable_sie
The sie instruction requires address spaces to be switched
to run proper. This patch verifies that this is the case
in s390_enable_sie, otherwise the kernel would crash badly
as soon as the process runs into sie.

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:09 +01:00
Christian Borntraeger 3324e60aaf [S390] lockdep: trace hardirq off in smp_send_stop
With lockdep we got the following trace after a panic:

Badness at /home/autobuild/BUILD/linux-2.6.28-20090204/kernel/lockdep.c:2878
[...]
Call Trace:
 [<0000000000176334>] lock_acquire+0x54/0xbc
 [<000000000050b4fe>] __atomic_notifier_call_chain+0x6e/0xdc
 [<000000000050b59c>] atomic_notifier_call_chain+0x30/0x44
 [<0000000000504274>] panic+0xd0/0x1e8
[...]
INFO: lockdep is turned off.
Last Breaking-Event-Address:
 [<0000000000170e62>] check_flags+0xae/0x15c
possible reason: unannotated irqs-off.

lockdep is right. We missed a trace_hardirq_off in our smp_send_stop
function and smp_send_stop is called before the panic call chain.

Reported-by: Mijo <Safradin mijo@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:08 +01:00
Hendrik Brueckner 431429ff78 [S390] hvc_iucv: Provide IUCV z/VM user ID filtering
This patch introduces the kernel parameter hvc_iucv_allow= that specifies
a comma-separated list of z/VM user IDs.
If specified, the z/VM IUCV hypervisor console device driver accepts IUCV
connections from listed z/VM user IDs only.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:08 +01:00
Hendrik Brueckner 82f3a79bc6 [S390] hvc_iucv: Update and add missing kernel messages
If the hvc_iucv= kernel parameter specifies a value that is not
valid, display an error message.
Minor changes to existing kernel messages.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:07 +01:00
Heiko Carstens 5168ce2c64 [S390] cputime: initialize per thread timer values on fork
Initialize per thread timer values instead of just copying them from
the parent. That way it is easily possible to tell how much time a
thread spent in user/system context.
Doesn't fix a bug, this is just for debugging purposes.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:07 +01:00
Heiko Carstens cbdc229245 [S390] arch/s390/kernel/process.c: fix whitespace damage
Fix all the whitespace damage in process.c, especially copy_thread().
Next patch will add code to copy_thread() which needs to 'fixed' first.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:07 +01:00
Heiko Carstens 082fb301e0 [S390] delete drivers/s390/ebcdic.c
Dead file. Seems to be a leftover from the 2.4->2.5 conversion.
The used and uptodate version of this file is in arch/s390/kernel.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:06 +01:00
Heiko Carstens 94f5b09d97 [S390] move sysinfo.c from drivers/s390 to arch/s390/kernel
All in sysinfo.c is core kernel code and not driver code. So move it
to arch/s390/kernel. Also includes some small cleanups.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:06 +01:00
Stefan Haberland fc19f381b3 [S390] dasd: message cleanup
Moved some Messages into s390 debug feature and changed remaining
messages to use the dev_xxx and pr_xxx macros.

Signed-off-by: Stefan Haberland <stefan.haberland@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:05 +01:00
Stefan Weinhuber f3eb5384cf [S390] dasd: add High Performance FICON support
To support High Performance FICON, the DASD device driver has to
translate I/O requests into the new transport mode control words (TCW)
instead of the traditional (command mode) CCW requests.

Signed-off-by: Stefan Weinhuber <wein@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:05 +01:00
Stefan Weinhuber b44b0ab3ba [S390] dasd: add large volume support
The dasd device driver will now support ECKD devices with more then
65520 cylinders.
In the traditional ECKD adressing scheme each track is addressed
by a 16-bit cylinder and 16-bit head number. The new addressing
scheme makes use of the fact that the actual number of heads is
never larger then 15, so 12 bits of the head number can be redefined
to be part of the cylinder address.

Signed-off-by: Stefan Weinhuber <wein@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:05 +01:00
Jean-Baptiste Joret f9a28f7bc5 [S390] dasd_eckd / Write format R0 is now allowed BB
Permission is now granted to the subsystem to format write R0 with:
* an ID = CCHHR, where CC = physical cylinder number,
  HH = physical head number, and R = 0
* a key length of zero
* a data length of eight
* a data field containing all zeros

Signed-off-by: Jean-Baptiste Joret <joret@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:04 +01:00
Heiko Carstens 0000d03170 [S390] dasd: enable compat ioctls
All of the ioctls are compatible. Just enable them.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:04 +01:00
Heiko Carstens 59fa4392dd [S390] page fault: invoke oom-killer
s390 arch backend for 1c0fe6e3bd
"mm: invoke oom-killer from page fault".

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:03 +01:00
Frank Munzert 099b765139 [S390] Automatic IPL after dump
Provide new shutdown action "dump_reipl" for automatic ipl after dump.

Signed-off-by: Frank Munzert <munzert@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2009-03-26 15:24:03 +01:00
Christian Borntraeger d7fd5f1e3b [S390] fix dump_stack vs. %p and (null)
The s390 implemenation of dump_stack uses %p to display stack content.
Since d97106ab53 (Make %p print '(null)'
for NULL pointers) this causes a strange output for dump_stack:

[...]
Process basename (pid: 8822, task: 00000000b2ece038, ksp: 00000000b24d7b38)
04000000b5685c00 00000000b24d7760 0000000000000002 (null)
00000000b24d7800 00000000b24d7778 00000000b24d7778 00000000001052fe
(null) 00000000b24d7b38 (null) 000000000000000a
000000000000000d (null) 00000000b24d7760 00000000b24d77d8
000000000051a7e8 00000000001052fe 00000000b24d7760 00000000b24d77b0
Call Trace:
[...]

This patch changes our dump_stack to use the appropriate %x format.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 15:24:02 +01:00
Holger Eitzenberger d271e8bd8c ctnetlink: compute generic part of event more acurately
On a box with most of the optional Netfilter switches turned off some
of the NLAs are never send, e. g. secmark, mark or the conntrack
byte/packet counters.  As a worst case scenario this may possibly
still lead to ctnetlink skbs being reallocated in netlink_trim()
later, loosing all the nice effects from the previous patches.

I try to solve that (at least partly) by correctly #ifdef'ing the
NLAs in the computation.

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
2009-03-26 13:37:14 +01:00
Jens Axboe a2a9537ac0 Get rid of pdflush_operation() in emergency sync and remount
Opencode a cheasy approach with kevent. The idea here is that we'll
add some generic delayed work infrastructure, which probably wont be
based on pdflush (or maybe it will, in which case we can just add it
back).

This is in preparation for getting rid of pdflush completely.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2009-03-26 11:01:36 +01:00
Jens Axboe 6933c02e9c btrfs: get rid of current_is_pdflush() in btrfs_btree_balance_dirty
Chris says it's safe to kill.

Acked-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2009-03-26 11:01:35 +01:00
Jens Axboe 26160158d3 Move the default_backing_dev_info out of readahead.c and into backing-dev.c
It really makes no sense to have it in readahead.c, so move it where
it belongs.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2009-03-26 11:01:33 +01:00
Avishay Traeger 07e86f405a block: Repeated lines in switching-sched.txt
These lines appear in this file twice - removed one occurrence.

Signed-off-by: Avishay Traeger <avishay@il.ibm.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2009-03-26 11:01:28 +01:00
Boaz Harrosh e7cbbf1bf1 bsg: Remove bogus check against request_queue->max_sectors
bsg submits REQ_TYPE_BLOCK_PC so the right check is max_hw_sectors.
But I've removed this check because right after, bsg proceeds with
calling blk_rq_map_user() which does all the right checks.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2009-03-26 11:01:25 +01:00
Boaz Harrosh 1cd96c242a block: WARN in __blk_put_request() for potential bio leak
Put a WARN_ON in __blk_put_request if it is about to
leak bio(s). This is a serious bug that can happen in error
handling code paths.

For this to work I have fixed a couple of places in block/ where
request->bio != NULL ownership was not honored. And a small cleanup
at sg_io() while at it.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2009-03-26 11:01:23 +01:00
Nikanth Karthikesan f028f3b2f9 loop: fix circular locking in loop_clr_fd()
With CONFIG_PROVE_LOCKING enabled

$ losetup /dev/loop0 file
$ losetup -o 32256 /dev/loop1 /dev/loop0

$ losetup -d /dev/loop1
$ losetup -d /dev/loop0

triggers a [ INFO: possible circular locking dependency detected ]

I think this warning is a false positive.

Open/close on a loop device acquires bd_mutex of the device before
acquiring lo_ctl_mutex of the same device. For ioctl(LOOP_CLR_FD) after
acquiring lo_ctl_mutex, fput on the backing_file might acquire the bd_mutex of
a device, if backing file is a device and this is the last reference to the
file being dropped . But it is guaranteed that it is impossible to have a
circular list of backing devices.(say loop2->loop1->loop0->loop2 is not
possible), which guarantees that this can never deadlock.

So this warning should be suppressed. It is very difficult to annotate lockdep
not to warn here in the correct way. A simple way to silence lockdep could be
to mark the lo_ctl_mutex in ioctl to be a sub class, but this might mask some
other real bugs.

@@ -1164,7 +1164,7 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode,
 	struct loop_device *lo = bdev->bd_disk->private_data;
 	int err;

-	mutex_lock(&lo->lo_ctl_mutex);
+	mutex_lock_nested(&lo->lo_ctl_mutex, 1);
 	switch (cmd) {
 	case LOOP_SET_FD:
 		err = loop_set_fd(lo, mode, bdev, arg);

Or actually marking the bd_mutex after lo_ctl_mutex as a sub class could be
a better solution.

Luckily it is easy to avoid calling fput on backing file with lo_ctl_mutex
held, so no lockdep annotation is required.

If you do not like the special handling of the lo_ctl_mutex just for the
LOOP_CLR_FD ioctl in lo_ioctl(), the mutex handling could be moved inside
each of the individual ioctl handlers and I could send you another patch.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2009-03-26 11:01:19 +01:00