X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fattr.c;h=fb83f5795d1964c2b13d7c7ceb6f49f91643e3a0;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=5f78d75a8ddfd7ce5dd2e5a754369f8ad2d5a3ea;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/fs/attr.c b/fs/attr.c index 5f78d75a8..fb83f5795 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -14,9 +14,10 @@ #include #include #include -#include +#include #include #include +#include /* Taken over from the old code... */ @@ -64,22 +65,19 @@ int inode_change_ok(struct inode *inode, struct iattr *attr) goto fine; if (IS_BARRIER(inode)) { - printk(KERN_WARNING - "VSW: xid=%d messing with the barrier.\n", + vxwprintk(1, "xid=%d messing with the barrier.", vx_current_xid()); goto error; } switch (inode->i_sb->s_magic) { case PROC_SUPER_MAGIC: - printk(KERN_WARNING - "VSW: xid=%d messing with the procfs.\n", + vxwprintk(1, "xid=%d messing with the procfs.", vx_current_xid()); goto error; case DEVPTS_SUPER_MAGIC: if (vx_check(inode->i_xid, VX_IDENT)) goto fine; - printk(KERN_WARNING - "VSW: xid=%d messing with the devpts.\n", + vxwprintk(1, "xid=%d messing with the devpts.", vx_current_xid()); goto error; } @@ -135,11 +133,14 @@ int inode_setattr(struct inode * inode, struct iattr * attr) if (ia_valid & ATTR_XID) inode->i_xid = attr->ia_xid; if (ia_valid & ATTR_ATIME) - inode->i_atime = attr->ia_atime; + inode->i_atime = timespec_trunc(attr->ia_atime, + inode->i_sb->s_time_gran); if (ia_valid & ATTR_MTIME) - inode->i_mtime = attr->ia_mtime; + inode->i_mtime = timespec_trunc(attr->ia_mtime, + inode->i_sb->s_time_gran); if (ia_valid & ATTR_CTIME) - inode->i_ctime = attr->ia_ctime; + inode->i_ctime = timespec_trunc(attr->ia_ctime, + inode->i_sb->s_time_gran); if (ia_valid & ATTR_MODE) { umode_t mode = attr->ia_mode; @@ -185,7 +186,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr) struct inode *inode = dentry->d_inode; mode_t mode = inode->i_mode; int error; - struct timespec now = CURRENT_TIME; + struct timespec now = current_fs_time(inode->i_sb); unsigned int ia_valid = attr->ia_valid; if (!inode) @@ -219,6 +220,9 @@ int notify_change(struct dentry * dentry, struct iattr * attr) if (!attr->ia_valid) return 0; + if (ia_valid & ATTR_SIZE) + down_write(&dentry->d_inode->i_alloc_sem); + if (inode->i_op && inode->i_op->setattr) { error = security_inode_setattr(dentry, attr); if (!error) @@ -236,6 +240,10 @@ int notify_change(struct dentry * dentry, struct iattr * attr) error = inode_setattr(inode, attr); } } + + if (ia_valid & ATTR_SIZE) + up_write(&dentry->d_inode->i_alloc_sem); + if (!error) { unsigned long dn_mask = setattr_mask(ia_valid); if (dn_mask)