ocfs2: Allow uid/gid/perm changes of symlinks
authorSunil Mushran <sunil.mushran@oracle.com>
Fri, 18 Apr 2008 17:23:53 +0000 (10:23 -0700)
committerMark Fasheh <mfasheh@suse.com>
Thu, 1 May 2008 00:09:54 +0000 (17:09 -0700)
This patch adds the ability to change attributes of a symlink.
Fixes oss bugzilla#963
http://oss.oracle.com/bugzilla/show_bug.cgi?id=963

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
fs/ocfs2/file.c
fs/ocfs2/symlink.c

index 9154c82d3258e5afc4b88fde94ecc68fc0aa91e2..57e0d30cde9816e048577b69027b5d2cbb92b2ba 100644 (file)
@@ -1048,6 +1048,10 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
        mlog_entry("(0x%p, '%.*s')\n", dentry,
                   dentry->d_name.len, dentry->d_name.name);
 
+       /* ensuring we don't even attempt to truncate a symlink */
+       if (S_ISLNK(inode->i_mode))
+               attr->ia_valid &= ~ATTR_SIZE;
+
        if (attr->ia_valid & ATTR_MODE)
                mlog(0, "mode change: %d\n", attr->ia_mode);
        if (attr->ia_valid & ATTR_UID)
index 7134007ba22fa4142f6f0f9714828bfee7174225..ba9dbb51d25b5ed120922d9192e7098d239d7f5c 100644 (file)
@@ -167,9 +167,11 @@ const struct inode_operations ocfs2_symlink_inode_operations = {
        .readlink       = page_readlink,
        .follow_link    = ocfs2_follow_link,
        .getattr        = ocfs2_getattr,
+       .setattr        = ocfs2_setattr,
 };
 const struct inode_operations ocfs2_fast_symlink_inode_operations = {
        .readlink       = ocfs2_readlink,
        .follow_link    = ocfs2_follow_link,
        .getattr        = ocfs2_getattr,
+       .setattr        = ocfs2_setattr,
 };