lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANGUGtDCV28y=aO6rrPEbsY+u4hMq_r8+HDVeCdRE_9Yd2i0ow@mail.gmail.com>
Date:	Tue, 23 Oct 2012 09:39:44 +0200
From:	Marco Stornelli <marco.stornelli@...il.com>
To:	Jaegeuk Kim <jaegeuk.kim@...sung.com>
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	gregkh@...uxfoundation.org, viro@...iv.linux.org.uk, arnd@...db.de,
	tytso@....edu, chur.lee@...sung.com, cm224.lee@...sung.com,
	jooyoung.hwang@...sung.com
Subject: Re: [PATCH 08/16 v2] f2fs: add file operations

2012/10/23 Jaegeuk Kim <jaegeuk.kim@...sung.com>:
>> > +void f2fs_truncate(struct inode *inode)
>> > +{
>> > +       if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
>> > +                               S_ISLNK(inode->i_mode)))
>> > +               return;
>> > +
>> > +       if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
>> > +               return;
>>
>> No truncate for an append only file? You call f2fs_truncate from
>> evict_inode, so no block freeing when this kind of inode is deleted.
>
> Agreed.
>
>>
>> > +
>> > +       if (!truncate_blocks(inode, i_size_read(inode))) {
>> > +               inode->i_mtime = inode->i_ctime = CURRENT_TIME;
>> > +               mark_inode_dirty(inode);
>> > +       }
>> > +
>> > +       f2fs_balance_fs(F2FS_SB(inode->i_sb));
>> > +}
>> > +
>> > +static int f2fs_getattr(struct vfsmount *mnt,
>> > +                        struct dentry *dentry, struct kstat *stat)
>> > +{
>> > +       struct inode *inode = dentry->d_inode;
>> > +       generic_fillattr(inode, stat);
>> > +       stat->blocks <<= 3;
>> > +       return 0;
>> > +}
>> > +
>> > +#ifdef CONFIG_F2FS_FS_POSIX_ACL
>> > +static void __setattr_copy(struct inode *inode, const struct iattr *attr)
>> > +{
>> > +       struct f2fs_inode_info *fi = F2FS_I(inode);
>> > +       unsigned int ia_valid = attr->ia_valid;
>> > +
>> > +       if (ia_valid & ATTR_UID)
>> > +               inode->i_uid = attr->ia_uid;
>> > +       if (ia_valid & ATTR_GID)
>> > +               inode->i_gid = attr->ia_gid;
>> > +       if (ia_valid & ATTR_ATIME)
>> > +               inode->i_atime = timespec_trunc(attr->ia_atime,
>> > +                                               inode->i_sb->s_time_gran);
>> > +       if (ia_valid & ATTR_MTIME)
>> > +               inode->i_mtime = timespec_trunc(attr->ia_mtime,
>> > +                                               inode->i_sb->s_time_gran);
>> > +       if (ia_valid & ATTR_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 (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
>> > +                       mode &= ~S_ISGID;
>> > +               set_acl_inode(fi, mode);
>> > +       }
>> > +}
>> > +#else
>> > +#define __setattr_copy setattr_copy
>> > +#endif
>> > +
>> > +int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
>> > +{
>> > +       struct inode *inode = dentry->d_inode;
>> > +       struct f2fs_inode_info *fi = F2FS_I(inode);
>> > +       int err;
>> > +
>> > +       err = inode_change_ok(inode, attr);
>> > +       if (err)
>> > +               return err;
>> > +
>> > +       if ((attr->ia_valid & ATTR_SIZE) &&
>> > +                       attr->ia_size != i_size_read(inode)) {
>> > +               truncate_setsize(inode, attr->ia_size);
>> > +               f2fs_truncate(inode);
>>
>> No need to call truncate_pagecache & co.?
>
> truncate_setsize() calls truncate_pagecache().
> Any comment?

Yep, I didn't get my coffee yet :)

Marco
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ