+#include <linux/vs_tag.h>
/**
- * inode_change_ok - check if attribute changes to an inode are allowed
-@@ -77,6 +80,10 @@ int inode_change_ok(const struct inode *
+ * setattr_prepare - check if attribute changes to a dentry are allowed
+@@ -77,6 +80,10 @@ int setattr_prepare(struct dentry *dentry
return -EPERM;
}
+ if (dx_permission(inode, MAY_WRITE))
+ return -EACCES;
+
- return 0;
- }
- EXPORT_SYMBOL(inode_change_ok);
+ kill_priv:
+ /* User has permission for the change */
+ if (ia_valid & ATTR_KILL_PRIV) {
@@ -147,6 +154,8 @@ void setattr_copy(struct inode *inode, c
inode->i_uid = attr->ia_uid;
if (ia_valid & ATTR_GID)
+ if (in->i_op && in->i_op->setattr)
+ error = in->i_op->setattr(de, &attr);
+ else {
-+ error = inode_change_ok(in, &attr);
++ error = setattr_prepare(de, &attr);
+ if (!error) {
+ setattr_copy(in, &attr);
+ mark_inode_dirty(in);