From: adilger Date: Wed, 24 Sep 2003 00:31:06 +0000 (+0000) Subject: Fix POSIX utime.4 -EPERM on FIFO not owned by user. X-Git-Tag: v1_7_100~3200 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=e6d7144bfe13424a041aa5e4dcbd62f437eb36fd;p=fs%2Flustre-release.git Fix POSIX utime.4 -EPERM on FIFO not owned by user. We don't need to re-check the atime/mtime set flags in fsfilt_ext3_setattr, we do it already in mds_fix_attr(). b=56 --- diff --git a/lustre/ChangeLog b/lustre/ChangeLog index beff449..5d507ff 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -21,6 +21,7 @@ tbd - exit early from mds_open if we get a lookup error (1749) - partial page read at EOF wouldn't wait for disk before sending (1642) - avoid NULL deref in obdfilter when reading page past EOF (1592) + - bug 56: POSIX utime.4 -EPERM on FIFO not owned by user 2003-06-15 Phil Schwan * version v0_7 diff --git a/lustre/obdclass/fsfilt_ext3.c b/lustre/obdclass/fsfilt_ext3.c index c0c839a..89f97e6 100644 --- a/lustre/obdclass/fsfilt_ext3.c +++ b/lustre/obdclass/fsfilt_ext3.c @@ -294,6 +294,10 @@ static int fsfilt_ext3_setattr(struct dentry *dentry, void *handle, /* Don't allow setattr to change file type */ iattr->ia_mode = (inode->i_mode & S_IFMT)|(iattr->ia_mode & ~S_IFMT); + /* We set these flags on the client, but have already checked perms + * so don't confuse inode_change_ok. */ + iattr->ia_valid &= ~(ATTR_MTIME_SET | ATTR_ATIME_SET); + if (inode->i_op->setattr) { rc = inode->i_op->setattr(dentry, iattr); } else { diff --git a/lustre/obdclass/fsfilt_extN.c b/lustre/obdclass/fsfilt_extN.c index ac97d5a..8efc05b 100644 --- a/lustre/obdclass/fsfilt_extN.c +++ b/lustre/obdclass/fsfilt_extN.c @@ -288,6 +288,10 @@ static int fsfilt_extN_setattr(struct dentry *dentry, void *handle, /* Don't allow setattr to change file type */ iattr->ia_mode = (inode->i_mode & S_IFMT)|(iattr->ia_mode & ~S_IFMT); + /* We set these flags on the client, but have already checked perms + * so don't confuse inode_change_ok. */ + iattr->ia_valid &= ~(ATTR_MTIME_SET | ATTR_ATIME_SET); + if (inode->i_op->setattr) { rc = inode->i_op->setattr(dentry, iattr); } else { diff --git a/lustre/obdclass/fsfilt_reiserfs.c b/lustre/obdclass/fsfilt_reiserfs.c index 3d118fc..00a670d 100644 --- a/lustre/obdclass/fsfilt_reiserfs.c +++ b/lustre/obdclass/fsfilt_reiserfs.c @@ -98,10 +98,18 @@ static int fsfilt_reiserfs_setattr(struct dentry *dentry, void *handle, iattr->ia_mode = inode->i_mode; } } - if (inode->i_op->setattr) + + /* We set these flags on the client, but have already checked perms + * so don't confuse inode_change_ok. */ + iattr->ia_valid &= ~(ATTR_MTIME_SET | ATTR_ATIME_SET); + + if (inode->i_op->setattr) { rc = inode->i_op->setattr(dentry, iattr); - else - rc = inode_setattr(inode, iattr); + } else { + rc = inode_change_ok(inode, iattr); + if (!rc) + rc = inode_setattr(inode, iattr); + } unlock_kernel();