git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vserver 2.0 rc7
[linux-2.6.git]
/
fs
/
attr.c
diff --git
a/fs/attr.c
b/fs/attr.c
index
5f78d75
..
3317d4f
100644
(file)
--- a/
fs/attr.c
+++ b/
fs/attr.c
@@
-14,9
+14,10
@@
#include <linux/fcntl.h>
#include <linux/quotaops.h>
#include <linux/security.h>
#include <linux/fcntl.h>
#include <linux/quotaops.h>
#include <linux/security.h>
-#include <linux/
vs_bas
e.h>
+#include <linux/
tim
e.h>
#include <linux/proc_fs.h>
#include <linux/devpts_fs.h>
#include <linux/proc_fs.h>
#include <linux/devpts_fs.h>
+#include <linux/vserver/debug.h>
/* Taken over from the old code... */
/* 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)) {
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:
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;
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;
}
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)
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)
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)
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;
if (ia_valid & ATTR_MODE) {
umode_t mode = attr->ia_mode;
@@
-183,14
+184,17
@@
int setattr_mask(unsigned int ia_valid)
int notify_change(struct dentry * dentry, struct iattr * attr)
{
struct inode *inode = dentry->d_inode;
int notify_change(struct dentry * dentry, struct iattr * attr)
{
struct inode *inode = dentry->d_inode;
- mode_t mode
= inode->i_mode
;
+ mode_t mode;
int error;
int error;
- struct timespec now
= CURRENT_TIME
;
+ struct timespec now;
unsigned int ia_valid = attr->ia_valid;
if (!inode)
BUG();
unsigned int ia_valid = attr->ia_valid;
if (!inode)
BUG();
+ mode = inode->i_mode;
+ now = current_fs_time(inode->i_sb);
+
attr->ia_ctime = now;
if (!(ia_valid & ATTR_ATIME_SET))
attr->ia_atime = now;
attr->ia_ctime = now;
if (!(ia_valid & ATTR_ATIME_SET))
attr->ia_atime = now;
@@
-219,6
+223,9
@@
int notify_change(struct dentry * dentry, struct iattr * attr)
if (!attr->ia_valid)
return 0;
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)
if (inode->i_op && inode->i_op->setattr) {
error = security_inode_setattr(dentry, attr);
if (!error)
@@
-236,6
+243,10
@@
int notify_change(struct dentry * dentry, struct iattr * attr)
error = inode_setattr(inode, 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)
if (!error) {
unsigned long dn_mask = setattr_mask(ia_valid);
if (dn_mask)