03 Jan, 2009

40 commits

  • The N_TTY ldisc layer does not send SIGIO POLL_OUTs correctly when output is
    possible due to flawed handling of the TTY_DO_WRITE_WAKEUP bit. It will
    either send no SIGIOs at all or on every tty wakeup.

    The fix is to set the bit when the tty driver write would block and test
    and clear it on write wakeup.

    [Merged with existing N_TTY patches and a small buglet fixed -- Alan]

    Signed-off-by: Thomas Pfaff
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Thomas Pfaff
     
  • The underlying problem is that the device methods don't all correctly
    handle disconnected status and some keep reporting bytes pending which
    causes tcdrain to stall.

    When the cable is unplugged they are definitely gone, and as this is true
    for all USB cables we can fix it in the core usb serial code.

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • The PCI-card identified as "Oxford Semiconductor Ltd EXSYS EX-41092 Dual
    16950 Serial adapter" is only usable with other devices (i.e. not the same
    card) after doing a "setserial /dev/ttyS baud_base 115200". This
    baud_base should be default for this card.

    Signed-off-by: Niels de Vos
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Niels de Vos
     
  • Again this is a lot of common code we can unify

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • If we have no speed set at some point then we should not raise DTR/RTS at
    that point when opening as the tty is not ready

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Mark it broken

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Start sucking more commonality out of the drivers into a single piece of
    core code.

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Normalise them so we can use the common helpers later on

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Switch generic_serial to do port count locking via the tty_port structure
    ready for moving to a common port wait routine. Keep the old driver lock for
    internal calling so we don't risk messing up the drivers below until we
    are ready.

    Still needs kref conversions

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • This helps set the basis for moving block_til_ready into common code. We also
    introduce a tty_port_hangup helper as this will also be generally needed.

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • This moves another per device special out of what should be shared open
    wait paths into private methods

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • This was an alloc/clear wrapper but makes even less sense now it uses
    kzalloc. Kill it off.

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • This is the first step to generalising the various pieces of waiting logic
    duplicated in all sorts of serial drivers.

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Wrap access to task credentials so that they can be separated more easily from
    the task_struct during the introduction of COW creds.

    Change most current->(|e|s|fs)[ug]id to current_(|e|s|fs)[ug]id().

    Change some task->e?[ug]id to task_e?[ug]id(). In some places it makes more
    sense to use RCU directly rather than a convenient wrapper; these will be
    addressed by later patches.

    Signed-off-by: David Howells
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Add device funtion for usb serial console, so we can open /dev/console
    when we use a usb serial device as console.

    (Typecast removed as noted by Sergei Shtylyov)

    Signed-off-by: Kevin Hao
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Kevin Hao
     
  • this happening again by making use of 'const'.

    Signed-off-by: Russell King
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Russell King
     
  • scribble on its own reference structures.

    Signed-off-by: Russell King
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

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

    Signed-off-by: Andrew Morton
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Joe Peterson
     
  • 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
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Joe Peterson
     
  • 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
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Joe Peterson
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Jason Wessel
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Just nail the oddments now while this code is being touched

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Sukadev Bhattiprolu
     
  • 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
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Sukadev Bhattiprolu
     
  • 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
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Sukadev Bhattiprolu
     
  • /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
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Sukadev Bhattiprolu
     
  • Signed-off-by: Sukadev Bhattiprolu
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Sukadev Bhattiprolu
     
  • 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
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Sukadev Bhattiprolu
     
  • 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
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Sukadev Bhattiprolu
     
  • 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
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Sukadev Bhattiprolu
     
  • 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
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Sukadev Bhattiprolu