04 Jan, 2012

3 commits


21 Jul, 2011

3 commits

  • Btrfs needs to be able to control how filemap_write_and_wait_range() is called
    in fsync to make it less of a painful operation, so push down taking i_mutex and
    the calling of filemap_write_and_wait() down into the ->fsync() handlers. Some
    file systems can drop taking the i_mutex altogether it seems, like ext3 and
    ocfs2. For correctness sake I just pushed everything down in all cases to make
    sure that we keep the current behavior the same for everybody, and then each
    individual fs maintainer can make up their mind about what to do from there.
    Thanks,

    Acked-by: Jan Kara
    Signed-off-by: Josef Bacik
    Signed-off-by: Al Viro

    Josef Bacik
     
  • Let filesystems handle waiting for direct I/O requests themselves instead
    of doing it beforehand. This means filesystem-specific locks to prevent
    new dio referenes from appearing can be held. This is important to allow
    generalizing i_dio_count to non-DIO_LOCKING filesystems.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     
  • Add a new rw_semaphore to protect bmap against truncate. Previous
    i_alloc_sem was abused for this, but it's going away in this series.

    Note that we can't simply use i_mutex, given that the swapon code
    calls ->bmap under it.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     

31 May, 2011

1 commit


10 Aug, 2010

3 commits

  • Make sure we check the truncate constraints early on in ->setattr by adding
    those checks to inode_change_ok. Also clean up and document inode_change_ok
    to make this obvious.

    As a fallout we don't have to call inode_newsize_ok from simple_setsize and
    simplify it down to a truncate_setsize which doesn't return an error. This
    simplifies a lot of setattr implementations and means we use truncate_setsize
    almost everywhere. Get rid of fat_setsize now that it's trivial and mark
    ext2_setsize static to make the calling convention obvious.

    Keep the inode_newsize_ok in vmtruncate for now as all callers need an
    audit for its removal anyway.

    Note: setattr code in ecryptfs doesn't call inode_change_ok at all and
    needs a deeper audit, but that is left for later.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     
  • Make sure we call inode_change_ok before doing any changes in ->setattr,
    and make sure to call it even if our fs wants to ignore normal UNIX
    permissions, but use the ATTR_FORCE to skip those.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     
  • Despite its name it's now a generic implementation of ->setattr, but
    rather a helper to copy attributes from a struct iattr to the inode.
    Rename it to setattr_copy to reflect this fact.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     

28 May, 2010

3 commits


17 May, 2010

1 commit

  • FAT does not require the BKL in its ioctl function, which is already serialized
    through a mutex. Since we're already touching the ioctl code, also fix the
    missing handling of FAT_IOCTL_GET_ATTRIBUTES in the compat code.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: OGAWA Hirofumi

    Arnd Bergmann
     

14 Sep, 2009

1 commit

  • fat_cont_expand() is the only user of sync_page_range_nolock(). It's also the
    only user of generic_osync_inode() which does not have a file open. So
    opencode needed actions for FAT so that we can convert generic_osync_inode() to
    a standard syncing path.

    Update a comment about generic_osync_inode().

    CC: OGAWA Hirofumi
    Signed-off-by: Jan Kara

    Jan Kara
     

11 Jul, 2009

1 commit


17 Jun, 2009

1 commit


12 Jun, 2009

1 commit

  • * mark directory data blocks as assoc. metadata
    * add new inode to deal with FAT, mark FAT blocks as assoc. metadata of that
    * now ->fsync() is trivial both for files and directories

    Signed-off-by: Al Viro

    Al Viro
     

08 Jun, 2009

1 commit


04 Jun, 2009

1 commit

  • On severe errors FAT remounts itself in read-only mode. Allow to
    specify FAT fs desired behavior through 'errors' mount option:
    panic, continue or remount read-only.

    `mount -t [fat|vfat] -o errors=[panic,remount-ro,continue] \
    `

    This is analog to ext2 fs 'errors' mount option.

    Signed-off-by: Denis Karpov
    Signed-off-by: OGAWA Hirofumi

    Denis Karpov
     

14 Nov, 2008

2 commits

  • Conflicts:
    security/keys/internal.h
    security/keys/process_keys.c
    security/keys/request_key.c

    Fixed conflicts above by using the non 'tsk' versions.

    Signed-off-by: James Morris

    James Morris
     
  • 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
    Reviewed-by: James Morris
    Acked-by: Serge Hallyn
    Acked-by: OGAWA Hirofumi
    Signed-off-by: James Morris

    David Howells
     

07 Nov, 2008

4 commits

  • FAT has the ATTR_RO (read-only) attribute. But on Windows, the ATTR_RO
    of the directory will be just ignored actually, and is used by only
    applications as flag. E.g. it's setted for the customized folder by
    Explorer.

    http://msdn2.microsoft.com/en-us/library/aa969337.aspx

    This adds "rodir" option. If user specified it, ATTR_RO is used as
    read-only flag even if it's the directory. Otherwise, inode->i_mode
    is not used to hold ATTR_RO (i.e. fat_mode_can_save_ro() returns 0).

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • If inode->i_mode doesn't have S_WUGO, current code assumes it means
    ATTR_RO. However, if (~[ufd]mask & S_WUGO) == 0, inode->i_mode can't
    hold S_WUGO. Therefore the updated directory entry will always have
    ATTR_RO.

    This adds fat_mode_can_hold_ro() to check it. And if inode->i_mode
    can't hold, uses -i_attrs to hold ATTR_RO instead.

    With this, we don't set ATTR_RO unless users change it via ioctl() if
    (~[ufd]mask & S_WUGO) == 0.

    And on FAT_IOCTL_GET_ATTRIBUTES path, this adds ->i_mutex to it for
    not returning the partially updated attributes by FAT_IOCTL_SET_ATTRIBUTES
    to userland.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • This adds three helpers:

    fat_make_attrs() - makes FAT attributes from inode.
    fat_make_mode() - makes mode_t from FAT attributes.
    fat_save_attrs() - saves FAT attributes to inode.

    Then this replaces: MSDOS_MKMODE() by fat_make_mode(), fat_attr() by
    fat_make_attrs(), ->i_attrs = attr & ATTR_UNUSED by fat_save_attrs().
    And for root inode, those is used with ATTR_DIR instead of bogus
    ATTR_NONE.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • This splits __KERNEL__ stuff in include/msdos_fs.h into fs/fat/fat.h.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

03 Aug, 2008

1 commit


27 Jul, 2008

1 commit

  • The FAT_IOCTL_SET_ATTRIBUTES ioctl() calls notify_change() to change
    the file mode before changing the inode attributes. Replace with
    explicit calls to security_inode_setattr(), fat_setattr() and
    fsnotify_change().

    This is equivalent to the original. The reason it is needed, is that
    later in the series we move the immutable check into notify_change().
    That would break the FAT_IOCTL_SET_ATTRIBUTES ioctl, as it needs to
    perform the mode change regardless of the immutability of the file.

    [Fix error if fat is built as a module. Thanks to OGAWA Hirofumi for
    noticing.]

    Signed-off-by: Miklos Szeredi
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Al Viro

    Miklos Szeredi
     

15 Jul, 2008

1 commit


03 Jul, 2008

1 commit


21 Jun, 2008

1 commit

  • This replaces the use of the BKL in the FAT family of filesystems with the
    existing superblock lock instead.

    The code already appears to do mostly proper locking with its own private
    spinlocks (and mutexes), but while the BKL could possibly have been
    dropped entirely, converting it to use the superblock lock (which is just
    a regular mutex) is the conservative thing to do.

    As a per-filesystem mutex, it not only won't have any of the possible
    latency issues related to the BKL, but the lock is obviously private to
    the particular filesystem instance and will thus not cause problems for
    entirely unrelated users like the BKL can.

    Signed-off-by: Linus Torvalds
    Cc: OGAWA Hirofumi
    Signed-off-by: Jonathan Corbet

    Linus Torvalds
     

13 Jun, 2008

1 commit

  • New chmod() allows only acceptable permission, and if not acceptable, it
    returns -EPERM. Old one allows even if it can't store permission to on
    disk inode. But it seems too strict for users.

    E.g. https://bugzilla.redhat.com/show_bug.cgi?id=449080: With new one,
    rsync couldn't create the temporary file.

    So, this patch allows like old one, but now it doesn't change the
    permission if it can't store, and it returns 0.

    Also, this patch fixes missing check.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

30 Apr, 2008

1 commit


28 Apr, 2008

3 commits

  • Normally utime(2) checks current process is owner of the file, or it
    has CAP_FOWNER capability. But FAT filesystem doesn't have uid/gid as
    on disk info, so normal check is too unflexible.

    With this option you can relax it.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • Fix fat_setattr() on the case of showexec option. If user specified
    showexec option, inode->i_mode may not have S_IXUGO. This just use
    inode->i_mode to fix it.

    And with this patch, we don't allow chmod() on memory inode, it's just
    bad behaviour. IOW, we allow changing S_IWUGO only which can be stored
    to disk.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • - Rename fat_notify_change() to fat_setattr()
    - check_mode() cleanup
    - Change layout of code

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

19 Apr, 2008

1 commit


07 Feb, 2008

1 commit

  • Prohibit mode changes in non-quiet mode that cannot be stored reliably with
    the on-disk format.

    Suppose a vfat filesystem is mounted with umask=0 and [not-quiet]. Then
    all files will have mode 0777. Trying to change the owner will fail,
    because fat does not know about owners or groups. chmod 0770, on the other
    hand, will succeed, even though fat does not know about the permission
    triplet [user/group/other].

    So this patch changes fat's not-quiet behavior so that only UNIX modes are
    accepted that can be mapped lossless between the fat disk format and the
    local system. There is only one attribute, and that is the readonly
    attribute, which is mapped to the UNIX write permission bit(s). chmod 0555
    is therefore valid (taking away the +w bits setting the readonly
    attribute). Since chmod 0775 and chmod 0755 is an ambiguous case as to
    whether to set or clear the readonly bit, these modes are also denied.

    In quiet mode, chmod and chown will continue to "succeed" as they did
    before, meaning that a subsequent stat() will temporarily return the new
    mode as long as the inode is not reread from disk, and chown will silently
    do nothing, not even return the new uid/gid in stat().

    Signed-off-by: Jan Engelhardt
    Cc: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Engelhardt
     

10 Jul, 2007

1 commit


13 Feb, 2007

1 commit

  • Many struct inode_operations in the kernel can be "const". Marking them const
    moves these to the .rodata section, which avoids false sharing with potential
    dirty data. In addition it'll catch accidental writes at compile time to
    these shared resources.

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven