1. 17 6月, 2007 1 次提交
    • J
      udf: fix possible leakage of blocks · 74584ae5
      Jan Kara 提交于
      We have to take care that when we call udf_discard_prealloc() from
      udf_clear_inode() we have to write inode ourselves afterwards (otherwise,
      some changes might be lost leading to leakage of blocks, use of free blocks
      or improperly aligned extents).
      
      Also udf_discard_prealloc() does two different things - it removes
      preallocated blocks and truncates the last extent to exactly match i_size.
      We move the latter functionality to udf_truncate_tail_extent(), call
      udf_discard_prealloc() when last reference to a file is dropped and call
      udf_truncate_tail_extent() when inode is being removed from inode cache
      (udf_clear_inode() call).
      
      We cannot call udf_truncate_tail_extent() earlier as subsequent open+write
      would find the last block of the file mapped and happily write to the end
      of it, although the last extent says it's shorter.
      
      [akpm@linux-foundation.org: Make checkpatch.pl happier]
      Signed-off-by: NJan Kara <jack@suse.cz>
      Cc: Eric Sandeen <sandeen@sandeen.net>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      74584ae5
  2. 01 6月, 2007 2 次提交
  3. 22 5月, 2007 1 次提交
    • A
      Detach sched.h from mm.h · e8edc6e0
      Alexey Dobriyan 提交于
      First thing mm.h does is including sched.h solely for can_do_mlock() inline
      function which has "current" dereference inside. By dealing with can_do_mlock()
      mm.h can be detached from sched.h which is good. See below, why.
      
      This patch
      a) removes unconditional inclusion of sched.h from mm.h
      b) makes can_do_mlock() normal function in mm/mlock.c
      c) exports can_do_mlock() to not break compilation
      d) adds sched.h inclusions back to files that were getting it indirectly.
      e) adds less bloated headers to some files (asm/signal.h, jiffies.h) that were
         getting them indirectly
      
      Net result is:
      a) mm.h users would get less code to open, read, preprocess, parse, ... if
         they don't need sched.h
      b) sched.h stops being dependency for significant number of files:
         on x86_64 allmodconfig touching sched.h results in recompile of 4083 files,
         after patch it's only 3744 (-8.3%).
      
      Cross-compile tested on
      
      	all arm defconfigs, all mips defconfigs, all powerpc defconfigs,
      	alpha alpha-up
      	arm
      	i386 i386-up i386-defconfig i386-allnoconfig
      	ia64 ia64-up
      	m68k
      	mips
      	parisc parisc-up
      	powerpc powerpc-up
      	s390 s390-up
      	sparc sparc-up
      	sparc64 sparc64-up
      	um-x86_64
      	x86_64 x86_64-up x86_64-defconfig x86_64-allnoconfig
      
      as well as my two usual configs.
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e8edc6e0
  4. 17 5月, 2007 1 次提交
    • C
      Remove SLAB_CTOR_CONSTRUCTOR · a35afb83
      Christoph Lameter 提交于
      SLAB_CTOR_CONSTRUCTOR is always specified. No point in checking it.
      Signed-off-by: NChristoph Lameter <clameter@sgi.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Cc: Steven French <sfrench@us.ibm.com>
      Cc: Michael Halcrow <mhalcrow@us.ibm.com>
      Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Cc: Miklos Szeredi <miklos@szeredi.hu>
      Cc: Steven Whitehouse <swhiteho@redhat.com>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Dave Kleikamp <shaggy@austin.ibm.com>
      Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: Anton Altaparmakov <aia21@cantab.net>
      Cc: Mark Fasheh <mark.fasheh@oracle.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Jan Kara <jack@ucw.cz>
      Cc: David Chinner <dgc@sgi.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a35afb83
  5. 09 5月, 2007 8 次提交
  6. 08 5月, 2007 1 次提交
    • C
      slab allocators: Remove SLAB_DEBUG_INITIAL flag · 50953fe9
      Christoph Lameter 提交于
      I have never seen a use of SLAB_DEBUG_INITIAL.  It is only supported by
      SLAB.
      
      I think its purpose was to have a callback after an object has been freed
      to verify that the state is the constructor state again?  The callback is
      performed before each freeing of an object.
      
      I would think that it is much easier to check the object state manually
      before the free.  That also places the check near the code object
      manipulation of the object.
      
      Also the SLAB_DEBUG_INITIAL callback is only performed if the kernel was
      compiled with SLAB debugging on.  If there would be code in a constructor
      handling SLAB_DEBUG_INITIAL then it would have to be conditional on
      SLAB_DEBUG otherwise it would just be dead code.  But there is no such code
      in the kernel.  I think SLUB_DEBUG_INITIAL is too problematic to make real
      use of, difficult to understand and there are easier ways to accomplish the
      same effect (i.e.  add debug code before kfree).
      
      There is a related flag SLAB_CTOR_VERIFY that is frequently checked to be
      clear in fs inode caches.  Remove the pointless checks (they would even be
      pointless without removeal of SLAB_DEBUG_INITIAL) from the fs constructors.
      
      This is the last slab flag that SLUB did not support.  Remove the check for
      unimplemented flags from SLUB.
      Signed-off-by: NChristoph Lameter <clameter@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      50953fe9
  7. 13 2月, 2007 2 次提交
  8. 09 12月, 2006 1 次提交
  9. 08 12月, 2006 3 次提交
  10. 06 10月, 2006 1 次提交
  11. 01 10月, 2006 4 次提交
  12. 30 9月, 2006 1 次提交
    • E
      [PATCH] mount udf UDF_PART_FLAG_READ_ONLY partitions with MS_RDONLY · 39b3f6d6
      Eric Sandeen 提交于
      There's a bug where a UDF_PART_FLAG_READ_ONLY udf partition gets mounted
      read-write, then subsequent problems happen; files seem to be able to be
      removed, but file creation results in EIO or worse, oops.
      
      EIO is coming from udf_new_block(), which returns EIO if the right flags
      aren't set; only UDF_PART_FLAG_READ_ONLY is set in this case.  We probably
      s hould not have gotten this far...
      
      Attached patch seems to fix it - and includes a printk to alert the user
      that their "rw" mount request has been converted to "ro."
      
      Here's the testcase I used:
      
      [root@magnesium ~]# mkisofs -R -J -udf -o testiso /tmp/
      ...
      Total translation table size: 0
      Total rockridge attributes bytes: 342923
      Total directory bytes: 382312
      Path table size(bytes): 104
      Max brk space used 103000
      105059 extents written (205 MB)
      
      [root@magnesium ~]# mount -o loop testiso /mnt/test/
      [root@magnesium ~]# ls /mnt/test/fsfile
      /mnt/test/fsfile
      [root@magnesium ~]# rm /mnt/test/fsfile
      [root@magnesium ~]# ls /mnt/test/fsfile
      ls: /mnt/test/fsfile: No such file or directory
      [root@magnesium ~]# touch /mnt/test/fsfile
      touch: cannot touch `/mnt/test/fsfile': Input/output error
      [root@magnesium tmp]# grep udf /proc/mounts
      /dev/loop1 /mnt/test udf rw 0 0
      
      Force readonly mounts of UDF partitions marked as read-only.
      Signed-off-by: NEric Sandeen <sandeen@sandeen.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      39b3f6d6
  13. 27 9月, 2006 3 次提交
  14. 23 8月, 2006 1 次提交
  15. 15 8月, 2006 1 次提交
    • D
      [PATCH] initialize parts of udf inode earlier in create · 95f8797f
      Dan Bastone 提交于
      Eric says:
      
      > I saw an oops down this path when trying to create a new file on a UDF
      > filesystem which was internally marked as readonly, but mounted rw:
      >
      > udf_create
      >         udf_new_inode
      >                 new_inode
      >                         alloc_inode
      >                         	udf_alloc_inode
      >                 udf_new_block
      >                         returns EIO due to readonlyness
      >                 iput (on error)
      
      I ran into the same issue today, but when listing a directory with
      invalid/corrupt entries:
      
      udf_lookup
              udf_iget
                      get_new_inode_fast
                              alloc_inode
                                      udf_alloc_inode
                      __udf_read_inode
                              fails for any reason
                      iput (on error)
                              ...
      
      The following patch to udf_alloc_inode() should take care of both (and
      other similar) cases, but I've only tested it with udf_lookup().
      Signed-off-by: NDan Bastone <dan@pwienterprises.com>
      Cc: Eric Sandeen <sandeen@sandeen.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      95f8797f
  16. 06 8月, 2006 1 次提交
    • E
      [PATCH] udf: initialize parts of inode earlier in create · 225add61
      Eric Sandeen 提交于
      I saw an oops down this path when trying to create a new file on a UDF
      filesystem which was internally marked as readonly, but mounted rw:
      
      udf_create
              udf_new_inode
                      new_inode
                              alloc_inode
                              	udf_alloc_inode
                      udf_new_block
                              returns EIO due to readonlyness
                      iput (on error)
                              udf_put_inode
                                      udf_discard_prealloc
                                              udf_next_aext
                                                      udf_current_aext
                                                              udf_get_fileshortad
                                                                      OOPS
      
      the udf_discard_prealloc() path was examining uninitialized fields of the
      udf inode.
      
      udf_discard_prealloc() already has this code to short-circuit the discard
      path if no extents are preallocated:
      
              if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB ||
                      inode->i_size == UDF_I_LENEXTENTS(inode))
              {
                      return;
              }
      
      so if we initialize UDF_I_LENEXTENTS(inode) = 0 earlier in udf_new_inode,
      we won't try to free the (not) preallocated blocks, since this will match
      the i_size = 0 set when the inode was initialized.
      Signed-off-by: NEric Sandeen <sandeen@sandeen.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      225add61
  17. 01 7月, 2006 1 次提交
  18. 29 6月, 2006 1 次提交
  19. 23 6月, 2006 2 次提交
    • D
      [PATCH] VFS: Permit filesystem to perform statfs with a known root dentry · 726c3342
      David Howells 提交于
      Give the statfs superblock operation a dentry pointer rather than a superblock
      pointer.
      
      This complements the get_sb() patch.  That reduced the significance of
      sb->s_root, allowing NFS to place a fake root there.  However, NFS does
      require a dentry to use as a target for the statfs operation.  This permits
      the root in the vfsmount to be used instead.
      
      linux/mount.h has been added where necessary to make allyesconfig build
      successfully.
      
      Interest has also been expressed for use with the FUSE and XFS filesystems.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NAl Viro <viro@zeniv.linux.org.uk>
      Cc: Nathan Scott <nathans@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      726c3342
    • D
      [PATCH] VFS: Permit filesystem to override root dentry on mount · 454e2398
      David Howells 提交于
      Extend the get_sb() filesystem operation to take an extra argument that
      permits the VFS to pass in the target vfsmount that defines the mountpoint.
      
      The filesystem is then required to manually set the superblock and root dentry
      pointers.  For most filesystems, this should be done with simple_set_mnt()
      which will set the superblock pointer and then set the root dentry to the
      superblock's s_root (as per the old default behaviour).
      
      The get_sb() op now returns an integer as there's now no need to return the
      superblock pointer.
      
      This patch permits a superblock to be implicitly shared amongst several mount
      points, such as can be done with NFS to avoid potential inode aliasing.  In
      such a case, simple_set_mnt() would not be called, and instead the mnt_root
      and mnt_sb would be set directly.
      
      The patch also makes the following changes:
      
       (*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
           pointer argument and return an integer, so most filesystems have to change
           very little.
      
       (*) If one of the convenience function is not used, then get_sb() should
           normally call simple_set_mnt() to instantiate the vfsmount. This will
           always return 0, and so can be tail-called from get_sb().
      
       (*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
           dcache upon superblock destruction rather than shrink_dcache_anon().
      
           This is required because the superblock may now have multiple trees that
           aren't actually bound to s_root, but that still need to be cleaned up. The
           currently called functions assume that the whole tree is rooted at s_root,
           and that anonymous dentries are not the roots of trees which results in
           dentries being left unculled.
      
           However, with the way NFS superblock sharing are currently set to be
           implemented, these assumptions are violated: the root of the filesystem is
           simply a dummy dentry and inode (the real inode for '/' may well be
           inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
           with child trees.
      
           [*] Anonymous until discovered from another tree.
      
       (*) The documentation has been adjusted, including the additional bit of
           changing ext2_* into foo_* in the documentation.
      
      [akpm@osdl.org: convert ipath_fs, do other stuff]
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NAl Viro <viro@zeniv.linux.org.uk>
      Cc: Nathan Scott <nathans@sgi.com>
      Cc: Roland Dreier <rolandd@cisco.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      454e2398
  20. 02 4月, 2006 1 次提交
  21. 29 3月, 2006 1 次提交
  22. 26 3月, 2006 1 次提交
  23. 24 3月, 2006 1 次提交