1. 06 1月, 2009 8 次提交
    • C
      add a vfs_fsync helper · 4c728ef5
      Christoph Hellwig 提交于
      Fsync currently has a fdatawrite/fdatawait pair around the method call,
      and a mutex_lock/unlock of the inode mutex.  All callers of fsync have
      to duplicate this, but we have a few and most of them don't quite get
      it right.  This patch adds a new vfs_fsync that takes care of this.
      It's a little more complicated as usual as ->fsync might get a NULL file
      pointer and just a dentry from nfsd, but otherwise gets afile and we
      want to take the mapping and file operations from it when it is there.
      
      Notes on the fsync callers:
      
       - ecryptfs wasn't calling filemap_fdatawrite / filemap_fdatawait on the
         	lower file
       - coda wasn't calling filemap_fdatawrite / filemap_fdatawait on the host
      	file, and returning 0 when ->fsync was missing
       - shm wasn't calling either filemap_fdatawrite / filemap_fdatawait nor
         taking i_mutex.  Now given that shared memory doesn't have disk
         backing not doing anything in fsync seems fine and I left it out of
         the vfs_fsync conversion for now, but in that case we might just
         not pass it through to the lower file at all but just call the no-op
         simple_sync_file directly.
      
      [and now actually export vfs_fsync]
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      4c728ef5
    • E
      sys_execve and sys_uselib do not call into fsnotify · 6110e3ab
      Eric Paris 提交于
      sys_execve and sys_uselib do not call into fsnotify so inotify does not get
      open events for these types of syscalls.  This patch simply makes the
      requisite fsnotify calls.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      6110e3ab
    • A
      zero i_uid/i_gid on inode allocation · 56ff5efa
      Al Viro 提交于
      ... and don't bother in callers.  Don't bother with zeroing i_blocks,
      while we are at it - it's already been zeroed.
      
      i_mode is not worth the effort; it has no common default value.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      56ff5efa
    • A
      inode->i_op is never NULL · acfa4380
      Al Viro 提交于
      We used to have rather schizophrenic set of checks for NULL ->i_op even
      though it had been eliminated years ago.  You'd need to go out of your
      way to set it to NULL explicitly _and_ a bunch of code would die on
      such inodes anyway.  After killing two remaining places that still
      did that bogosity, all that crap can go away.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      acfa4380
    • A
      ntfs: don't NULL i_op · 9742df33
      Al Viro 提交于
      it's already set to empty table (and no, ntfs doesn't have any explicit
      checks for NULL ->i_op or NULL ->i_fop)
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      9742df33
    • A
      isofs check for NULL ->i_op in root directory is dead code · 261964c6
      Al Viro 提交于
      for one thing it never happens, for another we check that inode
      is a directory right after that place anyway (and we'd already
      checked that reading it from disk has not failed).
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      261964c6
    • A
      affs: do not zero ->i_op · c765d479
      Al Viro 提交于
      it is already set to empty table and should never be NULL
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      c765d479
    • A
      vfs: lseek(fd, 0, SEEK_CUR) race condition · 5b6f1eb9
      Alain Knaff 提交于
      This patch fixes a race condition in lseek. While it is expected that
      unpredictable behaviour may result while repositioning the offset of a
      file descriptor concurrently with reading/writing to the same file
      descriptor, this should not happen when merely *reading* the file
      descriptor's offset.
      
      Unfortunately, the only portable way in Unix to read a file
      descriptor's offset is lseek(fd, 0, SEEK_CUR); however executing this
      concurrently with read/write may mess up the position.
      
      [with fixes from akpm]
      Signed-off-by: NAlain Knaff <alain@knaff.lu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      5b6f1eb9
  2. 04 1月, 2009 3 次提交
  3. 03 1月, 2009 10 次提交
    • D
      CRED: Wrap task credential accesses in the devpts filesystem · d0eafc7d
      David Howells 提交于
      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: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d0eafc7d
    • A
      devpts: fix unused function warning · 8c056e5b
      Andrew Morton 提交于
      fs/devpts/inode.c:324: warning: 'compare_init_pts_sb' defined but not used
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8c056e5b
    • A
      devpts: Coding style clean up · 835aa440
      Alan Cox 提交于
      Just nail the oddments now while this code is being touched
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      835aa440
    • S
      Enable multiple instances of devpts · 2a1b2dc0
      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: NSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2a1b2dc0
    • S
      Define get_init_pts_sb() · d4076ac5
      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: NSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d4076ac5
    • S
      Define mknod_ptmx() · 1f8f1e29
      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: NSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1f8f1e29
    • S
      Extract option parsing to new function · 53af8ee4
      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: NSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      53af8ee4
    • S
      Per-mount 'config' object · 31af0abb
      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: NSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      31af0abb
    • S
      Per-mount allocated_ptys · e76b7c01
      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: NSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e76b7c01
    • S
      Remove devpts_root global · 59e55e6c
      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: NSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      59e55e6c
  4. 01 1月, 2009 19 次提交