linux-2.6
15 years agoConvert the oxsemi tornado special cases to use the quirk interface and not
Russell King [Fri, 2 Jan 2009 13:44:20 +0000 (13:44 +0000)] 
Convert the oxsemi tornado special cases to use the quirk interface and not

scribble on its own reference structures.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agodevpts: fix unused function warning
Andrew Morton [Fri, 2 Jan 2009 13:44:12 +0000 (13:44 +0000)] 
devpts: fix unused function warning

fs/devpts/inode.c:324: warning: 'compare_init_pts_sb' defined but not used

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agotty: Fix close races in USB serial
Alan Cox [Fri, 2 Jan 2009 13:44:04 +0000 (13:44 +0000)] 
tty: Fix close races in USB serial

USB serial has always had races where the tty port usage count can hit zero
during a receive event. The internal locking is a mutex so we can't use
that in the IRQ handlers.

With krefs we can tackle this differently but we still need to be careful.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agon_tty: Output bells immediately on a full buffer
Joe Peterson [Fri, 2 Jan 2009 13:43:40 +0000 (13:43 +0000)] 
n_tty: Output bells immediately on a full buffer

This patch causes "bell" (^G) characters (invoked when the input buffer
is full) to be immediately output rather than filling the echo buffer.

This is especially a problem when the tty is stopped and buffers fill, since
the bells do not serve their purpose of immediate notification that the
buffer cannot take further input, and they will flush all at once when the
tty is restarted.

Signed-off-by: Joe Peterson <joe@skyrush.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agon_tty: Fix hanfling of buffer full corner cases
Joe Peterson [Fri, 2 Jan 2009 13:43:32 +0000 (13:43 +0000)] 
n_tty: Fix hanfling of buffer full corner cases

Fix the handling of input characters when the tty buffer is full or nearly
full.  This includes tests that are done in n_tty_receive_char() and handling
of PARMRK.

Problems with the buffer-full tests done in receive_char() caused characters to
be lost at times when the buffer(s) filled.  Also, these full conditions
would often only be detected with echo on, and PARMRK was not accounted for
properly in all cases.  One symptom of these problems, in addition to lost
characters, was early termination from unix commands like tr and cat when
^Q was used to break from a stopped tty with full buffers (note that breaking
out was often previously not possible, due to the pty getting in "gridlock",
which will be addressed in another patch).  Note space is always reserved
at the end of the buffer for a newline (or EOF/EOL) in canonical mode.

Signed-off-by: Joe Peterson <joe@skyrush.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agon_tty: Fix handling of control characters and continuations
Joe Peterson [Fri, 2 Jan 2009 13:43:25 +0000 (13:43 +0000)] 
n_tty: Fix handling of control characters and continuations

Fix process_output_block to detect continuation characters correctly
and to handle control characters even when O_OLCUC is enabled.  Make
similar change to do_output_char().

Signed-off-by: Joe Peterson <joe@skyrush.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agopty: simplify resize
Alan Cox [Fri, 2 Jan 2009 13:43:17 +0000 (13:43 +0000)] 
pty: simplify resize

We have special case logic for resizing pty/tty pairs. We also have a per
driver resize method so for the pty case we should use it.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agotty: Fix sparse static warning for tty_driver_lookup_tty
Jason Wessel [Fri, 2 Jan 2009 13:43:04 +0000 (13:43 +0000)] 
tty: Fix sparse static warning for tty_driver_lookup_tty

Fixed sparse warning:
drivers/char/tty_io.c:1216:19: warning: symbol 'tty_driver_lookup_tty' was not declared. Should it be static?

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agosierra: Fix formatting
Alan Cox [Fri, 2 Jan 2009 13:42:56 +0000 (13:42 +0000)] 
sierra: Fix formatting

Andrew Morton wrote:

in drivers/usb/serial/sierra.c:

        } else {
                if (urb->actual_length) {
+               tty = tty_port_tty_get(&port->port);
                        tty_buffer_request_room(tty, urb->actual_length);

it's missing a tab.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agodevpts: Coding style clean up
Alan Cox [Fri, 2 Jan 2009 13:42:48 +0000 (13:42 +0000)] 
devpts: Coding style clean up

Just nail the oddments now while this code is being touched

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoDocument usage of multiple-instances of devpts
Sukadev Bhattiprolu [Fri, 2 Jan 2009 13:42:34 +0000 (13:42 +0000)] 
Document usage of multiple-instances of devpts

Changelog [v2]:
- Add note indicating strict isolation is not possible unless all
  mounts of devpts use the 'newinstance' mount option.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoEnable multiple instances of devpts
Sukadev Bhattiprolu [Fri, 2 Jan 2009 13:42:27 +0000 (13:42 +0000)] 
Enable multiple instances of devpts

To support containers, allow multiple instances of devpts filesystem, such
that indices of ptys allocated in one instance are independent of ptys
allocated in other instances of devpts.

But to preserve backward compatibility, enable this support for multiple
instances only if:

- CONFIG_DEVPTS_MULTIPLE_INSTANCES is set to Y, and
- '-o newinstance' mount option is specified while mounting devpts

To use multi-instance mount, a container startup script could:

$ ns_exec -cm /bin/bash
$ umount /dev/pts
$ mount -t devpts -o newinstance lxcpts /dev/pts
$ mount -o bind /dev/pts/ptmx /dev/ptmx
$ /usr/sbin/sshd -p 1234

where 'ns_exec -cm /bin/bash' is calls clone() with CLONE_NEWNS flag and execs
/bin/bash in the child process. A pty created by the sshd is not visible in
the original mount of /dev/pts.

USER-SPACE-IMPACT:
- See Documentation/fs/devpts.txt (included in next patch) for user-
  space impact in multi-instance and mixed-mode operation.
TODO:
- Update mount(8), pts(4) man pages. Highlight impact of not
  redirecting /dev/ptmx to /dev/pts/ptmx after a multi-instance mount.

Changelog[v6]:
- [Dave Hansen] Use new get_init_pts_sb() interface
- [Serge Hallyn] Don't bother displaying 'newinstance' in show_options
- [Serge Hallyn] Use macros (PARSE_REMOUNT/PARSE_MOUNT) instead of 0/1.
- [Serge Hallyn] Check error return from get_sb_single() (now
  get_init_pts_sb())
- devpts_pty_kill(): don't dput error dentries

Changelog[v5]:
- Move get_sb_ref() definition to earlier patch
- Move usage info to Documentation/filesystems/devpts.txt (next patch)
- Make ptmx node even in init_pts_ns, now that default mode is 0000
  (defined in earlier patch, enabled here).
- Cache ptmx dentry and use to update mode during remount
  (defined in earlier patch, enabled here).
- Bugfix: explicitly ignore newinstance on remount (if newinstance was
  specified on remount of initial mount, it would be ignored but
  /proc/mounts would imply that the option was set)

Changelog[v4]:

- Update patch description to address H. Peter Anvin's comments
- Consolidate multi-instance mode code under new config token,
  CONFIG_DEVPTS_MULTIPLE_INSTANCE.
- Move usage-details from patch description to
  Documentation/fs/devpts.txt

Changelog[v3]:
- Rename new mount option to 'newinstance'
- Create ptmx nodes only in 'newinstance' mounts
- Bugfix: parse_mount_options() modifies @data but since we need to
  parse the @data twice (once in devpts_get_sb() and once during
  do_remount_sb()), parse a local copy of @data in devpts_get_sb().
  (restructured code in devpts_get_sb() to fix this)

Changelog[v2]:
- Support both single-mount and multiple-mount semantics and
  provide '-onewmnt' option to select the semantics.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoDefine get_init_pts_sb()
Sukadev Bhattiprolu [Fri, 2 Jan 2009 13:42:19 +0000 (13:42 +0000)] 
Define get_init_pts_sb()

See comments in the function header for details. The new interface will
be used in a follow-on patch.

Changelog [v2]:
[Dave Hansen] Replace get_sb_ref() in fs/super.c with get_init_pts_sb()
and make the new interface private to devpts

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoDefine mknod_ptmx()
Sukadev Bhattiprolu [Fri, 2 Jan 2009 13:42:02 +0000 (13:42 +0000)] 
Define mknod_ptmx()

/dev/ptmx is closely tied to the devpts filesystem. An open of /dev/ptmx,
allocates the next pty index and the associated device shows up in the
devpts fs as /dev/pts/n.

Wih multiple instancs of devpts filesystem, during an open of /dev/ptmx
we would be unable to determine which instance of the devpts is being
accessed.

So we move the 'ptmx' node into /dev/pts and use the inode of the 'ptmx'
node to identify the superblock and hence the devpts instance.  This patch
adds ability for the kernel to internally create the [ptmx, c, 5:2] device
when mounting devpts filesystem.  Since the ptmx node in devpts is new and
may surprise some userspace scripts, the default permissions for the new
node is 0000.  These permissions can be changed either using chmod or by
remounting with the new '-o ptmxmode=0666' mount option.

Changelog[v5]:
- [Serge Hallyn bugfix]: Letting new_inode() assign inode number to
  ptmx can collide with hand-assigning inode numbers to ptys. So,
  hand-assign specific inode number to ptmx node also.
- [Serge Hallyn]: Maybe safer to grab root dentry mutex while creating
  ptmx node
- [Bugfix with Serge Hallyn] Replace lookup_one_len() in mknod_ptmx()
  wih d_alloc_name() (lookup during ->get_sb() locks up system). To
  simplify patchset, fold the ptmx_dentry patch into this.

Changelog[v4]:
- Change default permissions of pts/ptmx node to 0000.
- Move code for ptmxmode under #ifdef CONFIG_DEVPTS_MULTIPLE_INSTANCES.

Changelog[v3]:
- Rename ptmx_mode to ptmxmode (for consistency with 'newinstance')

Changelog[v2]:
- [H. Peter Anvin] Remove mknod() system call support and create the
  ptmx node internally.

Changelog[v1]:
- Earlier version of this patch enabled creating /dev/pts/tty as
  well. As pointed out by Al Viro and H. Peter Anvin, that is not
  really necessary.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoAdd DEVPTS_MULTIPLE_INSTANCES config token
Sukadev Bhattiprolu [Fri, 2 Jan 2009 13:41:54 +0000 (13:41 +0000)] 
Add DEVPTS_MULTIPLE_INSTANCES config token

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoExtract option parsing to new function
Sukadev Bhattiprolu [Fri, 2 Jan 2009 13:41:47 +0000 (13:41 +0000)] 
Extract option parsing to new function

Move code to parse mount options into a separate function so it can
(later) be shared between mount and remount operations.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoPer-mount 'config' object
Sukadev Bhattiprolu [Fri, 2 Jan 2009 13:41:33 +0000 (13:41 +0000)] 
Per-mount 'config' object

With support for multiple mounts of devpts, the 'config' structure really
represents per-mount options rather than config parameters. Rename 'config'
structure to 'pts_mount_opts' and store it in the super-block.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoPer-mount allocated_ptys
Sukadev Bhattiprolu [Fri, 2 Jan 2009 13:41:21 +0000 (13:41 +0000)] 
Per-mount allocated_ptys

To enable multiple mounts of devpts, 'allocated_ptys' must be a per-mount
variable rather than a global variable.  Move 'allocated_ptys' into the
super_block's s_fs_info.

Changelog[v2]:
Define and use DEVPTS_SB() wrapper.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoRemove devpts_root global
Sukadev Bhattiprolu [Fri, 2 Jan 2009 13:41:11 +0000 (13:41 +0000)] 
Remove devpts_root global

Remove the 'devpts_root' global variable and find the root dentry using
the super_block. The super-block can be found from the device inode, using
the new wrapper, pts_sb_from_inode().

Changelog: This patch is based on an earlier patchset from Serge Hallyn
   and Matt Helsley.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agon_tty: clean up coding style
Alan Cox [Fri, 2 Jan 2009 13:41:04 +0000 (13:41 +0000)] 
n_tty: clean up coding style

Now the main work is done its polishing time

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agon_tty: Fix loss of echoed characters and remove bkl from n_tty
Joe Peterson [Fri, 2 Jan 2009 13:40:53 +0000 (13:40 +0000)] 
n_tty: Fix loss of echoed characters and remove bkl from n_tty

Fixes the loss of echoed (and other ldisc-generated characters) when
the tty is stopped or when the driver output buffer is full (happens
frequently for input during continuous program output, such as ^C)
and removes the Big Kernel Lock from the N_TTY line discipline.

Adds an "echo buffer" to the N_TTY line discipline that handles all
ldisc-generated output (including echoed characters).  Along with the
loss of characters, this also fixes the associated loss of sync between
tty output and the ldisc state when characters cannot be immediately
written to the tty driver.

The echo buffer stores (in addition to characters) state operations that need
to be done at the time of character output (like management of the column
position).  This allows echo to cooperate correctly with program output,
since the ldisc state remains consistent with actual characters written.

Since the echo buffer code now isolates the tty column state code
to the process_out* and process_echoes functions, we can remove the
Big Kernel Lock (BKL) and replace it with mutex locks.

Highlights are:

* Handles echo (and other ldisc output) when tty driver buffer is full
  - continuous program output can block echo
* Saves echo when tty is in stopped state (e.g. ^S)
  - (e.g.: ^Q will correctly cause held characters to be released for output)
* Control character pairs (e.g. "^C") are treated atomically and not
  split up by interleaved program output
* Line discipline state is kept consistent with characters sent to
  the tty driver
* Remove the big kernel lock (BKL) from N_TTY line discipline

Signed-off-by: Joe Peterson <joe@skyrush.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoBlackfin Serial Driver: Remove BI status for known_good_char
Sonic Zhang [Fri, 2 Jan 2009 13:40:45 +0000 (13:40 +0000)] 
Blackfin Serial Driver: Remove BI status for known_good_char

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoBlackfin Serial Driver: Fix bug - BF527-EZKIT unable to receive large files over...
Sonic Zhang [Fri, 2 Jan 2009 13:40:38 +0000 (13:40 +0000)] 
Blackfin Serial Driver: Fix bug - BF527-EZKIT unable to receive large files over UART in DMA mode

Add spin_lock_irqsave() when receive and transfer data.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoBlackfin Serial Driver: Clean serial console and early prink code.
Sonic Zhang [Fri, 2 Jan 2009 13:40:31 +0000 (13:40 +0000)] 
Blackfin Serial Driver: Clean serial console and early prink code.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoBlackfin Serial Driver: fix bug - SIR driver stop receiving randomly
Graf Yang [Fri, 2 Jan 2009 13:40:22 +0000 (13:40 +0000)] 
Blackfin Serial Driver: fix bug - SIR driver stop receiving randomly

Bug description:
The IRDA receiver may can't receiving any more after processed some signals.

To duplicate this issue is put three IRDA devices together, one blackfin,
two none blackfin, they will detect each other. Let one none blackfin devices
irdaping the blackfin devices, when it stopped print out ping information,
it is the time that blackfin stoped receiving, the time is random.

The related register bit is OK, the other devices is sending data continuously.
But no interrupt come.

Fixing:
I tried Michael's suggestion that request the UARTx error interrupt, and reset
the IRDA when found FE error. This method helps much, but it can't completely
avoid stop.

Reset the IRDA before every time sending the data is more safe.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoBlackfin Serial Driver: updates kgdb over Blackfin serial driver with kgdb framework
Sonic Zhang [Fri, 2 Jan 2009 13:40:14 +0000 (13:40 +0000)] 
Blackfin Serial Driver: updates kgdb over Blackfin serial driver with kgdb framework

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agokbuild: Remove gcc 4.1.0 quirk from init/main.c
Ingo Molnar [Fri, 2 Jan 2009 15:16:16 +0000 (16:16 +0100)] 
kbuild: Remove gcc 4.1.0 quirk from init/main.c

Impact: cleanup

We now have a cleaner check for gcc 4.1.0/4.1.1 trouble in
include/linux/compiler-gcc4.h, so remove the 4.1.0 quirk from
init/main.c.

Reported-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoDisallow gcc versions 4.1.{0,1}
Linus Torvalds [Fri, 2 Jan 2009 17:29:43 +0000 (09:29 -0800)] 
Disallow gcc versions 4.1.{0,1}

These compiler versions are known to miscompile __weak functions and
thus generate kernels that don't necessarily work correctly.  If a weak
function is int he same compilation unit as a caller, gcc may end up
inlining it, and thus binding the weak function too early.

See

    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27781

for details.

Cc: Adrian Bunk <bunk@kernel.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoSanitize gcc version header includes
Linus Torvalds [Fri, 2 Jan 2009 17:23:03 +0000 (09:23 -0800)] 
Sanitize gcc version header includes

 - include the gcc version-dependent header files from the generic gcc
   header file, rather than the other way around (iow: don't make the
   non-gcc header file have to know about gcc versions)

 - don't include compiler-gcc4.h for gcc 5 (for whenever it gets
   released).  That's just confusing and made us do odd things in the
   gcc4 header file (testing that we really had version 4!)

 - generate the name from the __GNUC__ version directly, rather than
   having a mess of #if conditionals.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoide-atapi: start dma in a drive-specific way
Borislav Petkov [Fri, 2 Jan 2009 15:12:56 +0000 (16:12 +0100)] 
ide-atapi: start dma in a drive-specific way

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: put the rest of non-ide-cd code into the else-clause of ide_transfer_pc
Borislav Petkov [Fri, 2 Jan 2009 15:12:56 +0000 (16:12 +0100)] 
ide-atapi: put the rest of non-ide-cd code into the else-clause of ide_transfer_pc

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: remove timeout arg to ide_issue_pc
Borislav Petkov [Fri, 2 Jan 2009 15:12:56 +0000 (16:12 +0100)] 
ide-atapi: remove timeout arg to ide_issue_pc

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-cd: remove handler wrappers
Borislav Petkov [Fri, 2 Jan 2009 15:12:55 +0000 (16:12 +0100)] 
ide-cd: remove handler wrappers

Remove cdrom_do_newpc_cont and cdrom_start_rw_cont wrappers and pass
cdrom_transfer_packet_command to ide_execute_command directly.

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
[bart: don't move cdrom_start_packet_command() around, remove newlines]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-cd: remove xferlen arg to cdrom_start_packet_command
Borislav Petkov [Fri, 2 Jan 2009 15:12:55 +0000 (16:12 +0100)] 
ide-cd: remove xferlen arg to cdrom_start_packet_command

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: split drive-specific functionality in ide_issue_pc
Borislav Petkov [Fri, 2 Jan 2009 15:12:55 +0000 (16:12 +0100)] 
ide-atapi: split drive-specific functionality in ide_issue_pc

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: assign expiry and timeout based on device type
Borislav Petkov [Fri, 2 Jan 2009 15:12:55 +0000 (16:12 +0100)] 
ide-atapi: assign expiry and timeout based on device type

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: compute cmd_len based on device type in ide_transfer_pc
Borislav Petkov [Fri, 2 Jan 2009 15:12:54 +0000 (16:12 +0100)] 
ide-atapi: compute cmd_len based on device type in ide_transfer_pc

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
[bart: move cmd_len check closer to ->output_data() call]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove the last ide-scsi remnants
Borislav Petkov [Fri, 2 Jan 2009 15:12:54 +0000 (16:12 +0100)] 
ide: remove the last ide-scsi remnants

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: remove ide-scsi remnants from ide_pc_intr()
Borislav Petkov [Fri, 2 Jan 2009 15:12:54 +0000 (16:12 +0100)] 
ide-atapi: remove ide-scsi remnants from ide_pc_intr()

As a result, remove now unused ide_scsi_get_timeout and ide_scsi_expiry.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: remove ide-scsi remnants from ide_transfer_pc()
Borislav Petkov [Fri, 2 Jan 2009 15:12:53 +0000 (16:12 +0100)] 
ide-atapi: remove ide-scsi remnants from ide_transfer_pc()

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: remove ide-scsi remnants from ide_issue_pc
Borislav Petkov [Fri, 2 Jan 2009 15:12:53 +0000 (16:12 +0100)] 
ide-atapi: remove ide-scsi remnants from ide_issue_pc

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-cd: move cdrom_timer_expiry to ide-atapi.c
Borislav Petkov [Fri, 2 Jan 2009 15:12:53 +0000 (16:12 +0100)] 
ide-cd: move cdrom_timer_expiry to ide-atapi.c

- cdrom_timer_expiry -> ide_cd_expiry
- remove expiry-arg to ide_issue_pc as it is redundant now
- ide_debug_log -> debug_log

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: teach ide atapi about drive->waiting_for_dma
Borislav Petkov [Fri, 2 Jan 2009 15:12:53 +0000 (16:12 +0100)] 
ide-atapi: teach ide atapi about drive->waiting_for_dma

In addition, we wait for DRQ to be asserted by repeatedly polling
device status no matter what DRQ type each device implements.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: accomodate transfer length calculation for ide-cd
Borislav Petkov [Fri, 2 Jan 2009 15:12:52 +0000 (16:12 +0100)] 
ide-atapi: accomodate transfer length calculation for ide-cd

... by factoring it out of ide_cd_do_request() into a helper, as suggested by
Bart.

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
[bart: BLK_DEV_IDECD needs to select IDE_ATAPI now]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: setup dma for ide-cd
Borislav Petkov [Fri, 2 Jan 2009 15:12:52 +0000 (16:12 +0100)] 
ide-atapi: setup dma for ide-cd

There should be no functional change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: combine drive-specific assignments
Borislav Petkov [Fri, 2 Jan 2009 15:12:52 +0000 (16:12 +0100)] 
ide-atapi: combine drive-specific assignments

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: add a dev_is_idecd-inline
Borislav Petkov [Fri, 2 Jan 2009 15:12:52 +0000 (16:12 +0100)] 
ide-atapi: add a dev_is_idecd-inline

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoremove ide-scsi
FUJITA Tomonori [Fri, 2 Jan 2009 15:12:51 +0000 (16:12 +0100)] 
remove ide-scsi

As planed, this removes ide-scsi.

The 2.6 kernel supports direct writing to ide CD drives, which
eliminates the need for ide-scsi. ide-scsi has been unmaintained and
marked as deprecated.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: James.Bottomley@HansenPartnership.com
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-floppy: allocate only toplevel packet commands
Linus Torvalds [Fri, 2 Jan 2009 15:12:51 +0000 (16:12 +0100)] 
ide-floppy: allocate only toplevel packet commands

This makes the top-level function just allocate a single pc entry, and then
pass it down as a pointer to all the helper functions that also need one
of those "struct ide_atapi_pc" things. As far as I can tell, the use of
these things never overlaps each other, BUT I DID NOT CHECK VERY CLOSELY!

So I'm not guaranteeing this is correct, and I don't have the hardware. It
would be good for somebody who knows the code more, and has the hardware,
could please test this?

With this, ide-floppy still has fairly big stack usage, but instead of

idefloppy_ioctl [vmlinux]:              1208
ide_floppy_get_capacity [vmlinux]:      872
idefloppy_release [vmlinux]:            408
idefloppy_open [vmlinux]:               408

where those two first ones are at the very top of the list of stack users
for me, it's now

ide_floppy_get_capacity [vmlinux]:           404
ide_floppy_ioctl [vmlinux]:                  364

ie they are still high, but they are no longer at the top.

Borislav: Since ide_floppy_get_capacity is passed as a function pointer to other
parts of the kernel (e.g., block layer) we need that ide_atapi_pc to be created
on stack. Also, redid stack users numbers above. The two functions missing from
Linus' original 'make stackusage' output are due to ide being
rewritten/reorganized atm.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: make IDE_AFLAG_.. numbering continuous again
Borislav Petkov [Fri, 2 Jan 2009 15:12:50 +0000 (16:12 +0100)] 
ide: make IDE_AFLAG_.. numbering continuous again

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-cd: move debug defines into header
Borislav Petkov [Fri, 2 Jan 2009 15:12:50 +0000 (16:12 +0100)] 
ide-cd: move debug defines into header

While at it:
- disable compiling-in debug support by default

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
[bart: fixup patch description]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: use per-device request queue locks (v2)
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:50 +0000 (16:12 +0100)] 
ide: use per-device request queue locks (v2)

* Move hack for flush requests from choose_drive() to do_ide_request().

* Add ide_plug_device() helper and convert core IDE code from using
  per-hwgroup lock as a request lock to use the ->queue_lock instead.

* Remove no longer needed:
  - choose_drive() function
  - WAKEUP() macro
  - 'sleeping' flag from ide_hwif_t
  - 'service_{start,time}' fields from ide_drive_t

This patch results in much simpler and more maintainable code
(besides being a scalability improvement).

v2:
* Fixes/improvements based on review from Elias:
  - take as many requests off the queue as possible
  - remove now redundant BUG_ON()

Cc: Elias Oltmanns <eo@nebensachen.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: add ide_[un]lock_hwgroup() helpers
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:50 +0000 (16:12 +0100)] 
ide: add ide_[un]lock_hwgroup() helpers

Add ide_[un]lock_hwgroup() inline helpers for obtaining exclusive
access to the given hwgroup and update the core code accordingly.

[ This change besides making code saner results in more efficient
  use of ide_{get,release}_lock(). ]

Cc: Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Elias Oltmanns <eo@nebensachen.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove "paranoia" checks for hwgroup->busy
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:49 +0000 (16:12 +0100)] 
ide: remove "paranoia" checks for hwgroup->busy

Remove "paranoia" checks for hwgroup->busy from ide_timer_expiry()
and ide_intr().  This is a preparation for future changes.

Cc: Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Elias Oltmanns <eo@nebensachen.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove IDE PM hack from do_ide_request()
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:49 +0000 (16:12 +0100)] 
ide: remove IDE PM hack from do_ide_request()

We now tell block layer that there is still work to do using
blk_plug_device() so hack for IDE Power Management can be removed
(it was buggy for hwgroups having more than 4 devices anyway).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: don't execute the next queued command from the hard-IRQ context (v2)
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:48 +0000 (16:12 +0100)] 
ide: don't execute the next queued command from the hard-IRQ context (v2)

* Tell the block layer that we are not done handling requests by using
  blk_plug_device() in ide_do_request() (request handling function)
  and ide_timer_expiry() (timeout handler) if the queue is not empty.

* Remove optimization which directly calls ide_do_request() for the next
  queued command from the ide_intr() (IRQ handler) and ide_timer_expiry().

* Remove no longer needed IRQ masking from ide_do_request() - in case of
  IDE ports needing serialization disable_irq_nosync()/enable_irq() was
  used for the (possibly shared) IRQ of the other IDE port.

* Put the misplaced comment in the right place in ide_do_request().

* Drop no longer needed 'int masked_irq' argument from ide_do_request().

* Merge ide_do_request() into do_ide_request().

* Remove no longer needed IDE_NO_IRQ define.

While at it:

* Don't use HWGROUP() macro in do_ide_request().

* Use __func__ in ide_intr().

This patch reduces IRQ hadling latency for IDE and improves the system-wide
handling of shared IRQs (which should result in more timeout resistant and
stable IDE systems).  It also makes it possible to do some further changes
later (i.e. replace some busy-waiting delays with sleeping equivalents).

v2:
Changes per review from Elias Oltmanns:
- fix wrong goto statement in 'if (startstop == ide_stopped)' block
- use spin_unlock_irq()
- don't use obsolete HWIF() macro

Cc: Elias Oltmanns <eo@nebensachen.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: move sysfs support to ide-sysfs.c
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:48 +0000 (16:12 +0100)] 
ide: move sysfs support to ide-sysfs.c

While at it:
- media_string() -> ide_media_string()

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: factor out device type classifying from do_identify()
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:47 +0000 (16:12 +0100)] 
ide: factor out device type classifying from do_identify()

Factor out device type classifying from do_identify()
to ide_classify_ata_dev() and ide_classify_atapi_dev().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: small ide_register_port() cleanup
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:47 +0000 (16:12 +0100)] 
ide: small ide_register_port() cleanup

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove chipset type fixup from ide_host_register()
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:47 +0000 (16:12 +0100)] 
ide: remove chipset type fixup from ide_host_register()

* Set chipset type explicitly in tx4938ide and tx4939ide host drivers
  (all other host drivers were updated already).

* Remove no longer used chipset type fixup from ide_host_register().

Acked-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agotx493x: fix indentation
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:46 +0000 (16:12 +0100)] 
tx493x: fix indentation

Trivial CodingStyle fixup for tx4938ide and tx4939ide drivers.

Acked-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Acked-by: Sergei Shtyltov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux...
David Vrabel [Fri, 2 Jan 2009 13:17:13 +0000 (13:17 +0000)] 
Merge branch 'master' of git://git./linux/kernel/git/torvalds/linux-2.6 into for-upstream

Conflicts:

drivers/uwb/wlp/eda.c

15 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
Linus Torvalds [Wed, 31 Dec 2008 23:57:56 +0000 (15:57 -0800)] 
Merge branch 'for-linus' of git://git./linux/kernel/git/viro/vfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (34 commits)
  nfsd race fixes: jfs
  nfsd race fixes: reiserfs
  nfsd race fixes: ext4
  nfsd race fixes: ext3
  nfsd race fixes: ext2
  nfsd/create race fixes, infrastructure
  filesystem notification: create fs/notify to contain all fs notification
  fs/block_dev.c: __read_mostly improvement and sb_is_blkdev_sb utilization
  kill ->dir_notify()
  filp_cachep can be static in fs/file_table.c
  fix f_count description in Documentation/filesystems/files.txt
  make INIT_FS use the __RW_LOCK_UNLOCKED initialization
  take init_fs to saner place
  kill vfs_permission
  pass a struct path * to may_open
  kill walk_init_root
  remove incorrect comment in inode_permission
  expand some comments (d_path / seq_path)
  correct wrong function name of d_put in kernel document and source comment
  fix switch_names() breakage in short-to-short case
  ...

15 years agonfsd race fixes: jfs
Dave Kleikamp [Wed, 31 Dec 2008 04:08:37 +0000 (22:08 -0600)] 
nfsd race fixes: jfs

jfs version of Al Viro's nfsd race patches

Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agonfsd race fixes: reiserfs
Al Viro [Tue, 30 Dec 2008 07:03:58 +0000 (02:03 -0500)] 
nfsd race fixes: reiserfs

... and the same for reiserfs.  The difference here is that we need
insert_inode_locked4() to match iget5_locked().

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agonfsd race fixes: ext4
Al Viro [Tue, 30 Dec 2008 07:03:31 +0000 (02:03 -0500)] 
nfsd race fixes: ext4

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agonfsd race fixes: ext3
Al Viro [Tue, 30 Dec 2008 07:02:50 +0000 (02:02 -0500)] 
nfsd race fixes: ext3

ext3 analog of the previous patch

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agonfsd race fixes: ext2
Al Viro [Tue, 30 Dec 2008 06:52:35 +0000 (01:52 -0500)] 
nfsd race fixes: ext2

* make ext2_new_inode() put the inode into icache in locked state
* do not unlock until the inode is fully set up; otherwise nfsd
might pick it in half-baked state.
* make sure that ext2_new_inode() does *not* lead to two inodes with the
same inumber hashed at the same time; otherwise a bogus fhandle coming
from nfsd might race with inode creation:

nfsd: iget_locked() creates inode
nfsd: try to read from disk, block on that.
ext2_new_inode(): allocate inode with that inumber
ext2_new_inode(): insert it into icache, set it up and dirty
ext2_write_inode(): get the relevant part of inode table in cache,
set the entry for our inode (and start writing to disk)
nfsd: get CPU again, look into inode table, see nice and sane on-disk
inode, set the in-core inode from it

oops - we have two in-core inodes with the same inumber live in icache,
both used for IO.  Welcome to fs corruption...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agonfsd/create race fixes, infrastructure
Al Viro [Tue, 30 Dec 2008 06:48:21 +0000 (01:48 -0500)] 
nfsd/create race fixes, infrastructure

new helpers - insert_inode_locked() and insert_inode_locked4().
Hash new inode, making sure that there's no such inode in icache
already.  If there is and it does not end up unhashed (as would
happen if we have nfsd trying to resolve a bogus fhandle), fail.
Otherwise insert our inode into hash and succeed.

In either case have i_state set to new+locked; cleanup ends up
being simpler with such calling conventions.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofilesystem notification: create fs/notify to contain all fs notification
Eric Paris [Wed, 17 Dec 2008 18:59:41 +0000 (13:59 -0500)] 
filesystem notification: create fs/notify to contain all fs notification

Creating a generic filesystem notification interface, fsnotify, which will be
used by inotify, dnotify, and eventually fanotify is really starting to
clutter the fs directory.  This patch simply moves inotify and dnotify into
fs/notify/inotify and fs/notify/dnotify respectively to make both current fs/
and future notification tidier.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofs/block_dev.c: __read_mostly improvement and sb_is_blkdev_sb utilization
Denis ChengRq [Mon, 1 Dec 2008 22:34:56 +0000 (14:34 -0800)] 
fs/block_dev.c: __read_mostly improvement and sb_is_blkdev_sb utilization

- iget5_locked in bdget really needs blockdev_superblock, instead of
  bd_mnt, so bd_mnt could be just a local variable;

- blockdev_superblock really needs __read_mostly, while local var bd_mnt
  not;

- make use of sb_is_blkdev_sb in bd_forget, instead of direct reference
  to blockdev_superblock.

Signed-off-by: Denis ChengRq <crquan@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agokill ->dir_notify()
Al Viro [Fri, 26 Dec 2008 05:57:40 +0000 (00:57 -0500)] 
kill ->dir_notify()

Remove the hopelessly misguided ->dir_notify().  The only instance (cifs)
has been broken by design from the very beginning; the objects it creates
are never destroyed, keep references to struct file they can outlive, nothing
that could possibly evict them exists on close(2) path *and* no locking
whatsoever is done to prevent races with close(), should the previous, er,
deficiencies someday be dealt with.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofilp_cachep can be static in fs/file_table.c
Eric Dumazet [Wed, 10 Dec 2008 17:35:45 +0000 (09:35 -0800)] 
filp_cachep can be static in fs/file_table.c

Instead of creating the "filp" kmem_cache in vfs_caches_init(),
we can do it a litle be later in files_init(), so that filp_cachep
is static to fs/file_table.c

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofix f_count description in Documentation/filesystems/files.txt
Eric Dumazet [Wed, 10 Dec 2008 17:35:45 +0000 (09:35 -0800)] 
fix f_count description in Documentation/filesystems/files.txt

Documentation/filesystems/files.txt was not updated when
f_count became an atomic_long_t.
atomic_long_inc_not_zero() is now used instead of atomic_inc_not_zero()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agomake INIT_FS use the __RW_LOCK_UNLOCKED initialization
Steven Rostedt [Wed, 10 Dec 2008 23:37:28 +0000 (18:37 -0500)] 
make INIT_FS use the __RW_LOCK_UNLOCKED initialization

[AV: rediffed on top of unification of init_fs]
Initialization of init_fs still uses the deprecated RW_LOCK_UNLOCKED macro.
This patch updates it to use the __RW_LOCK_UNLOCKED(lock) macro.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agotake init_fs to saner place
Al Viro [Fri, 26 Dec 2008 05:35:37 +0000 (00:35 -0500)] 
take init_fs to saner place

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agokill vfs_permission
Christoph Hellwig [Fri, 24 Oct 2008 07:59:29 +0000 (09:59 +0200)] 
kill vfs_permission

With all the nameidata removal there's no point anymore for this helper.
Of the three callers left two will go away with the next lookup series
anyway.

Also add proper kerneldoc to inode_permission as this is the main
permission check routine now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agopass a struct path * to may_open
Christoph Hellwig [Fri, 24 Oct 2008 07:58:10 +0000 (09:58 +0200)] 
pass a struct path * to may_open

No need for the nameidata in may_open - a struct path is enough.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agokill walk_init_root
Christoph Hellwig [Wed, 5 Nov 2008 14:07:21 +0000 (15:07 +0100)] 
kill walk_init_root

walk_init_root is a tiny helper that is marked __always_inline, has just
one caller and an unused argument.  Just merge it into the caller.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoremove incorrect comment in inode_permission
Christoph Hellwig [Wed, 5 Nov 2008 14:04:29 +0000 (15:04 +0100)] 
remove incorrect comment in inode_permission

We now pass on all MAY_ flags to the filesystems permission routines,
so remove the comment stating the contrary.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoexpand some comments (d_path / seq_path)
Arjan van de Ven [Mon, 1 Dec 2008 22:35:00 +0000 (14:35 -0800)] 
expand some comments (d_path / seq_path)

Explain that you really need to use the return value of d_path rather than
the buffer you passed into it.

Also fix the comment for seq_path(), the function arguments changed
recently but the comment hadn't been updated in sync.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agocorrect wrong function name of d_put in kernel document and source comment
Zhaolei [Mon, 1 Dec 2008 22:34:58 +0000 (14:34 -0800)] 
correct wrong function name of d_put in kernel document and source comment

no function named d_put(), it should be dput().

Impact: fix document and comment, no functionality changed

Signed-off-by: Zhao Lei <zhaolei@cn.fuijtsu.com>
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofix switch_names() breakage in short-to-short case
Al Viro [Mon, 3 Nov 2008 20:03:50 +0000 (15:03 -0500)] 
fix switch_names() breakage in short-to-short case

We want ->name.len to match the resulting name on *both*
source and target

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agobefs: ensure fast symlinks are NUL-terminated
Duane Griffin [Fri, 19 Dec 2008 20:47:18 +0000 (20:47 +0000)] 
befs: ensure fast symlinks are NUL-terminated

Ensure fast symlink targets are NUL-terminated, even if corrupted
on-disk.

Cc: Sergey S. Kostyliov <rathamahata@php4.ru>
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofreevxfs: ensure fast symlinks are NUL-terminated
Duane Griffin [Fri, 19 Dec 2008 20:47:17 +0000 (20:47 +0000)] 
freevxfs: ensure fast symlinks are NUL-terminated

Ensure fast symlink targets are NUL-terminated, even if corrupted
on-disk.

Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agosysv: ensure fast symlinks are NUL-terminated
Duane Griffin [Fri, 19 Dec 2008 20:47:16 +0000 (20:47 +0000)] 
sysv: ensure fast symlinks are NUL-terminated

Ensure fast symlink targets are NUL-terminated, even if corrupted
on-disk.

Cc: Christoph Hellwig <hch@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoext4: ensure fast symlinks are NUL-terminated
Duane Griffin [Fri, 19 Dec 2008 20:47:15 +0000 (20:47 +0000)] 
ext4: ensure fast symlinks are NUL-terminated

Ensure fast symlink targets are NUL-terminated, even if corrupted
on-disk.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: adilger@sun.com
Cc: linux-ext4@vger.kernel.org
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoext3: ensure fast symlinks are NUL-terminated
Duane Griffin [Fri, 19 Dec 2008 20:47:14 +0000 (20:47 +0000)] 
ext3: ensure fast symlinks are NUL-terminated

Ensure fast symlink targets are NUL-terminated, even if corrupted
on-disk.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: linux-ext4@vger.kernel.org
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoext2: ensure fast symlinks are NUL-terminated
Duane Griffin [Fri, 19 Dec 2008 20:47:13 +0000 (20:47 +0000)] 
ext2: ensure fast symlinks are NUL-terminated

Ensure fast symlink targets are NUL-terminated, even if corrupted
on-disk.

Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agovfs: ensure page symlinks are NUL-terminated
Duane Griffin [Fri, 19 Dec 2008 20:47:12 +0000 (20:47 +0000)] 
vfs: ensure page symlinks are NUL-terminated

On-disk data corruption could cause a page link to have its i_size set
to PAGE_SIZE (or a multiple thereof) and its contents all non-NUL.
NUL-terminate the link name to ensure this doesn't cause further
problems for the kernel.

Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agovfs: introduce helper function to safely NUL-terminate symlinks
Duane Griffin [Fri, 19 Dec 2008 20:47:11 +0000 (20:47 +0000)] 
vfs: introduce helper function to safely NUL-terminate symlinks

A number of filesystems were potentially triggering kernel bugs due to
corrupted symlink names on disk. This function helps safely terminate
the names.

Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoeCryptfs: check readlink result was not an error before using it
Duane Griffin [Fri, 19 Dec 2008 20:47:10 +0000 (20:47 +0000)] 
eCryptfs: check readlink result was not an error before using it

The result from readlink is being used to index into the link name
buffer without checking whether it is a valid length. If readlink
returns an error this will fault or cause memory corruption.

Cc: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Cc: Dustin Kirkland <kirkland@canonical.com>
Cc: ecryptfs-devel@lists.launchpad.net
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Acked-by: Michael Halcrow <mhalcrow@us.ibm.com>
Acked-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofs/namespace.c: drop code after return
Julia Lawall [Mon, 1 Dec 2008 22:34:51 +0000 (14:34 -0800)] 
fs/namespace.c: drop code after return

The extra semicolon serves no purpose.

Signed-off-by: Julia Lawall <julia@diku.dk>
Reviewed-by: Richard Genoud <richard.genoud@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoinclude: linux/fs.h: put declarations in __KERNEL__
Jan Engelhardt [Mon, 1 Dec 2008 22:34:50 +0000 (14:34 -0800)] 
include: linux/fs.h: put declarations in __KERNEL__

include/linux/fs.h contains externs for a bunch of variables.  That obviously
belongs under ifdef __KERNEL__.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoshrink struct dentry
Nick Piggin [Mon, 1 Dec 2008 08:33:43 +0000 (09:33 +0100)] 
shrink struct dentry

struct dentry is one of the most critical structures in the kernel. So it's
sad to see it going neglected.

With CONFIG_PROFILING turned on (which is probably the common case at least
for distros and kernel developers), sizeof(struct dcache) == 208 here
(64-bit). This gives 19 objects per slab.

I packed d_mounted into a hole, and took another 4 bytes off the inline
name length to take the padding out from the end of the structure. This
shinks it to 200 bytes. I could have gone the other way and increased the
length to 40, but I'm aiming for a magic number, read on...

I then got rid of the d_cookie pointer. This shrinks it to 192 bytes. Rant:
why was this ever a good idea? The cookie system should increase its hash
size or use a tree or something if lookups are a problem. Also the "fast
dcookie lookups" in oprofile should be moved into the dcookie code -- how
can oprofile possibly care about the dcookie_mutex? It gets dropped after
get_dcookie() returns so it can't be providing any sort of protection.

At 192 bytes, 21 objects fit into a 4K page, saving about 3MB on my system
with ~140 000 entries allocated. 192 is also a multiple of 64, so we get
nice cacheline alignment on 64 and 32 byte line systems -- any given dentry
will now require 3 cachelines to touch all fields wheras previously it
would require 4.

I know the inline name size was chosen quite carefully, however with the
reduction in cacheline footprint, it should actually be just about as fast
to do a name lookup for a 36 character name as it was before the patch (and
faster for other sizes). The memory footprint savings for names which are
<= 32 or > 36 bytes long should more than make up for the memory cost for
33-36 byte names.

Performance is a feature...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofs: reorder struct inotify_device on 64bits to remove padding
Richard Kennedy [Thu, 4 Dec 2008 11:17:47 +0000 (11:17 +0000)] 
fs: reorder struct inotify_device on 64bits to remove padding

Reorder struct inotify_device to remove 8 bytes of padding on 64bit
builds, reducing size to 128 bytes . Therefore allocating from a smaller
slab & using one fewer cachelines.

Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
----
Hi,
patch against 2.6.28-rc7.
built & tested on AMDX2 desktop.

I've not been able to send this to the listed inotify maintainers, I
just get mail failures. So I guessed filesystem was the best home for
it, hope that's ok.

regards
Richard
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agointroduce new LSM hooks where vfsmount is available.
Kentaro Takeda [Wed, 17 Dec 2008 04:24:15 +0000 (13:24 +0900)] 
introduce new LSM hooks where vfsmount is available.

Add new LSM hooks for path-based checks.  Call them on directory-modifying
operations at the points where we still know the vfsmount involved.

Signed-off-by: Kentaro Takeda <takedakn@nttdata.co.jp>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Toshiharu Harada <haradats@nttdata.co.jp>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoMerge branch 'irq-fixes-for-linus-4' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Wed, 31 Dec 2008 17:00:59 +0000 (09:00 -0800)] 
Merge branch 'irq-fixes-for-linus-4' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'irq-fixes-for-linus-4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  sparseirq: move __weak symbols into separate compilation unit
  sparseirq: work around __weak alias bug
  sparseirq: fix hang with !SPARSE_IRQ
  sparseirq: set lock_class for legacy irq when sparse_irq is selected
  sparseirq: work around compiler optimizing away __weak functions
  sparseirq: fix desc->lock init
  sparseirq: do not printk when migrating IRQ descriptors
  sparseirq: remove duplicated arch_early_irq_init()
  irq: simplify for_each_irq_desc() usage
  proc: remove ifdef CONFIG_SPARSE_IRQ from stat.c
  irq: for_each_irq_desc() move to irqnr.h
  hrtimer: remove #include <linux/irq.h>

15 years agoKVM: MMU: handle large host sptes on invlpg/resync
Marcelo Tosatti [Mon, 22 Dec 2008 20:49:30 +0000 (18:49 -0200)] 
KVM: MMU: handle large host sptes on invlpg/resync

The invlpg and sync walkers lack knowledge of large host sptes,
descending to non-existant pagetable level.

Stop at directory level in such case.

Fixes SMP Windows XP with hugepages.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
15 years agoKVM: Add locking to virtual i8259 interrupt controller
Avi Kivity [Sun, 21 Dec 2008 20:48:32 +0000 (22:48 +0200)] 
KVM: Add locking to virtual i8259 interrupt controller

While most accesses to the i8259 are with the kvm mutex taken, the call
to kvm_pic_read_irq() is not.  We can't easily take the kvm mutex there
since the function is called with interrupts disabled.

Fix by adding a spinlock to the virtual interrupt controller.  Since we
can't send an IPI under the spinlock (we also take the same spinlock in
an irq disabled context), we defer the IPI until the spinlock is released.
Similarly, we defer irq ack notifications until after spinlock release to
avoid lock recursion.

Signed-off-by: Avi Kivity <avi@redhat.com>