Commit 60bec29c authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: - Remove BKL use from ntfs_setattr() syncing up with the rest of the

        kernel.
      - Update ->setattr (fs/ntfs/inode.c::ntfs_setattr()) to refuse to
        change the uid, gid, and mode of an inode as we do not support NTFS
        ACLs yet.
Signed-off-by: default avatarAnton Altaparmakov <aia21@cantab.net>
parent f852c697
...@@ -21,6 +21,14 @@ ToDo/Notes: ...@@ -21,6 +21,14 @@ ToDo/Notes:
- Enable the code for setting the NT4 compatibility flag when we start - Enable the code for setting the NT4 compatibility flag when we start
making NTFS 1.2 specific modifications. making NTFS 1.2 specific modifications.
2.1.19-WIP
- Update ->setattr (fs/ntfs/inode.c::ntfs_setattr()) to refuse to
change the uid, gid, and mode of an inode as we do not support NTFS
ACLs yet.
- Remove BKL use from ntfs_setattr() syncing up with the rest of the
kernel.
2.1.18 - Fix scheduling latencies at mount time as well as an endianness bug. 2.1.18 - Fix scheduling latencies at mount time as well as an endianness bug.
- Remove vol->nr_mft_records as it was pretty meaningless and optimize - Remove vol->nr_mft_records as it was pretty meaningless and optimize
......
...@@ -6,7 +6,7 @@ ntfs-objs := aops.o attrib.o collate.o compress.o debug.o dir.o file.o \ ...@@ -6,7 +6,7 @@ ntfs-objs := aops.o attrib.o collate.o compress.o debug.o dir.o file.o \
index.o inode.o mft.o mst.o namei.o super.o sysctl.o unistr.o \ index.o inode.o mft.o mst.o namei.o super.o sysctl.o unistr.o \
upcase.o upcase.o
EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.18\" EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.19-WIP\"
ifeq ($(CONFIG_NTFS_DEBUG),y) ifeq ($(CONFIG_NTFS_DEBUG),y)
EXTRA_CFLAGS += -DDEBUG EXTRA_CFLAGS += -DDEBUG
......
...@@ -2270,7 +2270,11 @@ int ntfs_show_options(struct seq_file *sf, struct vfsmount *mnt) ...@@ -2270,7 +2270,11 @@ int ntfs_show_options(struct seq_file *sf, struct vfsmount *mnt)
* *
* We don't support i_size changes yet. * We don't support i_size changes yet.
* *
* Called with ->i_sem held. * Called with ->i_sem held. In all but one case ->i_alloc_sem is held for
* writing. The only case where ->i_alloc_sem is not held is
* mm/filemap.c::generic_file_buffered_write() where vmtruncate() is called
* with the current i_size as the offset which means that it is a noop as far
* as ntfs_truncate() is concerned.
*/ */
void ntfs_truncate(struct inode *vi) void ntfs_truncate(struct inode *vi)
{ {
...@@ -2292,64 +2296,59 @@ void ntfs_truncate(struct inode *vi) ...@@ -2292,64 +2296,59 @@ void ntfs_truncate(struct inode *vi)
* soon as possible, because we do not implement changes in i_size yet. So we * soon as possible, because we do not implement changes in i_size yet. So we
* abort all i_size changes here. * abort all i_size changes here.
* *
* Called with ->i_sem held. * We also abort all changes of user, group, and mode as we do not implement
* the NTFS ACLs yet.
*
* Called with ->i_sem held. For the ATTR_SIZE (i.e. ->truncate) case, also
* called with ->i_alloc_sem held for writing.
* *
* Basically this is a copy of generic notify_change() and inode_setattr() * Basically this is a copy of generic notify_change() and inode_setattr()
* functionality, except we intercept and abort changes in i_size. * functionality, except we intercept and abort changes in i_size.
*/ */
int ntfs_setattr(struct dentry *dentry, struct iattr *attr) int ntfs_setattr(struct dentry *dentry, struct iattr *attr)
{ {
struct inode *vi; struct inode *vi = dentry->d_inode;
int err; int err;
unsigned int ia_valid = attr->ia_valid; unsigned int ia_valid = attr->ia_valid;
vi = dentry->d_inode;
err = inode_change_ok(vi, attr); err = inode_change_ok(vi, attr);
if (err) if (err)
return err; return err;
if ((ia_valid & ATTR_UID && attr->ia_uid != vi->i_uid) || /* We do not support NTFS ACLs yet. */
(ia_valid & ATTR_GID && attr->ia_gid != vi->i_gid)) { if (ia_valid & (ATTR_UID | ATTR_GID | ATTR_MODE)) {
err = DQUOT_TRANSFER(vi, attr) ? -EDQUOT : 0; ntfs_warning(vi->i_sb, "Changes in user/group/mode are not "
if (err) "supported yet, ignoring.");
return err; err = -EOPNOTSUPP;
goto out;
} }
lock_kernel();
if (ia_valid & ATTR_SIZE) { if (ia_valid & ATTR_SIZE) {
ntfs_error(vi->i_sb, "Changes in i_size are not supported " if (attr->ia_size != i_size_read(vi)) {
"yet. Sorry."); ntfs_warning(vi->i_sb, "Changes in inode size are not "
"supported yet, ignoring.");
err = -EOPNOTSUPP;
// TODO: Implement... // TODO: Implement...
// err = vmtruncate(vi, attr->ia_size); // err = vmtruncate(vi, attr->ia_size);
err = -EOPNOTSUPP; if (err || ia_valid == ATTR_SIZE)
if (err) goto out;
goto trunc_err; } else {
/*
* We skipped the truncate but must still update
* timestamps.
*/
ia_valid |= ATTR_MTIME|ATTR_CTIME;
}
} }
if (ia_valid & ATTR_UID)
vi->i_uid = attr->ia_uid;
if (ia_valid & ATTR_GID)
vi->i_gid = attr->ia_gid;
if (ia_valid & ATTR_ATIME) if (ia_valid & ATTR_ATIME)
vi->i_atime = attr->ia_atime; vi->i_atime = attr->ia_atime;
if (ia_valid & ATTR_MTIME) if (ia_valid & ATTR_MTIME)
vi->i_mtime = attr->ia_mtime; vi->i_mtime = attr->ia_mtime;
if (ia_valid & ATTR_CTIME) if (ia_valid & ATTR_CTIME)
vi->i_ctime = attr->ia_ctime; vi->i_ctime = attr->ia_ctime;
if (ia_valid & ATTR_MODE) {
vi->i_mode = attr->ia_mode;
if (!in_group_p(vi->i_gid) &&
!capable(CAP_FSETID))
vi->i_mode &= ~S_ISGID;
}
mark_inode_dirty(vi); mark_inode_dirty(vi);
out:
trunc_err:
unlock_kernel();
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment