[f2fs-dev] [PATCH 5/7] xfs: refactor setflags to use setattr code directly

2019-06-21 Thread Darrick J. Wong
From: Darrick J. Wong Refactor the SETFLAGS implementation to use the SETXATTR code directly instead of partially constructing a struct fsxattr and calling bits and pieces of the setxattr code. This reduces code size and becomes necessary in the next patch to maintain the behavior of allowing us

[f2fs-dev] [PATCH 2/7] vfs: flush and wait for io when setting the immutable flag via SETFLAGS

2019-06-21 Thread Darrick J. Wong
From: Darrick J. Wong When we're using FS_IOC_SETFLAGS to set the immutable flag on a file, we need to ensure that userspace can't continue to write the file after the file becomes immutable. To make that happen, we have to flush all the dirty pagecache pages to disk to ensure that we can fail a

[f2fs-dev] [PATCH 3/7] vfs: flush and wait for io when setting the immutable flag via FSSETXATTR

2019-06-21 Thread Darrick J. Wong
From: Darrick J. Wong When we're using FS_IOC_FSSETXATTR to set the immutable flag on a file, we need to ensure that userspace can't continue to write the file after the file becomes immutable. To make that happen, we have to flush all the dirty pagecache pages to disk to ensure that we can fail

[f2fs-dev] [PATCH 1/4] vfs: create a generic checking function for FS_IOC_SETFLAGS

2019-06-21 Thread Darrick J. Wong
From: Darrick J. Wong Create a generic checking function for the incoming FS_IOC_SETFLAGS flag values so that we can standardize the implementations that follow ext4's flag values. Signed-off-by: Darrick J. Wong Reviewed-by: Jan Kara --- fs/btrfs/ioctl.c| 13 + fs/efivarfs/f

[f2fs-dev] [PATCH 7/7] vfs: don't allow writes to swap files

2019-06-21 Thread Darrick J. Wong
From: Darrick J. Wong Don't let userspace write to an active swap file because the kernel effectively has a long term lease on the storage and things could get seriously corrupted if we let this happen. Signed-off-by: Darrick J. Wong --- fs/attr.c |3 +++ mm/filemap.c |3 +++ mm/m

[f2fs-dev] [PATCH 1/7] mm/fs: don't allow writes to immutable files

2019-06-21 Thread Darrick J. Wong
From: Darrick J. Wong The chattr manpage has this to say about immutable files: "A file with the 'i' attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file, most of the file's metadata can not be modified, and the file can not be opened in write mode."

[f2fs-dev] [PATCH 4/7] vfs: don't allow most setxattr to immutable files

2019-06-21 Thread Darrick J. Wong
From: Darrick J. Wong The chattr manpage has this to say about immutable files: "A file with the 'i' attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file, most of the file's metadata can not be modified, and the file can not be opened in write mode."

[f2fs-dev] [PATCH 6/7] xfs: clean up xfs_merge_ioc_xflags

2019-06-21 Thread Darrick J. Wong
From: Darrick J. Wong Clean up the calling convention since we're editing the fsxattr struct anyway. Signed-off-by: Darrick J. Wong --- fs/xfs/xfs_ioctl.c | 32 ++-- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_i

[f2fs-dev] [PATCH v4 0/7] vfs: make immutable files actually immutable

2019-06-21 Thread Darrick J. Wong
Hi all, The chattr(1) manpage has this to say about the immutable bit that system administrators can set on files: "A file with the 'i' attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file, most of the file's metadata can not be modified, and the file

[f2fs-dev] [PATCH 3/4] fs: teach vfs_ioc_fssetxattr_check to check project id info

2019-06-21 Thread Darrick J. Wong
From: Darrick J. Wong Standardize the project id checks for FSSETXATTR. Signed-off-by: Darrick J. Wong Reviewed-by: Jan Kara --- fs/ext4/ioctl.c| 27 --- fs/f2fs/file.c | 27 --- fs/inode.c | 13 + fs/xfs/xfs_io

[f2fs-dev] [PATCH 4/4] vfs: teach vfs_ioc_fssetxattr_check to check extent size hints

2019-06-21 Thread Darrick J. Wong
From: Darrick J. Wong Move the extent size hint checks that aren't xfs-specific to the vfs. Signed-off-by: Darrick J. Wong Reviewed-by: Jan Kara --- fs/inode.c | 18 + fs/xfs/xfs_ioctl.c | 70 ++-- 2 files changed, 47 ins

[f2fs-dev] [PATCH 2/4] vfs: create a generic checking function for FS_IOC_FSSETXATTR

2019-06-21 Thread Darrick J. Wong
From: Darrick J. Wong Create a generic checking function for the incoming FS_IOC_FSSETXATTR fsxattr values so that we can standardize some of the implementation behaviors. Signed-off-by: Darrick J. Wong Reviewed-by: Jan Kara --- fs/btrfs/ioctl.c | 21 +--- fs/ext4/ioctl.c|

[f2fs-dev] [PATCH v2 0/4] vfs: clean up SETFLAGS and FSSETXATTR option processing

2019-06-21 Thread Darrick J. Wong
Hi all, The FS_IOC_SETFLAGS and FS_IOC_FSSETXATTR ioctls were promoted from ext4 and XFS, respectively, into the VFS. However, we didn't promote any of the parameter checking code from those filesystems, which lead to a mess where each filesystem open-codes whatever parameter checks they want and

Re: [f2fs-dev] [PATCH V3 0/7] Consolidate FS read I/O callbacks code

2019-06-21 Thread Eric Biggers
On Sun, Jun 16, 2019 at 09:38:06PM +0530, Chandan Rajendra wrote: > This patchset moves the "FS read I/O callbacks" code into a file of its > own (i.e. fs/read_callbacks.c) and modifies the generic > do_mpage_readpge() to make use of the functionality provided. > > "FS read I/O callbacks" code imp

Re: [f2fs-dev] [PATCH V3 3/7] fscrypt: remove struct fscrypt_ctx

2019-06-21 Thread Eric Biggers
On Sun, Jun 16, 2019 at 09:38:09PM +0530, Chandan Rajendra wrote: > -/** > - * fscrypt_get_ctx() - Get a decryption context > - * @gfp_flags: The gfp flag for memory allocation > - * > - * Allocate and initialize a decryption context. > - * > - * Return: A new decryption context on success; an ER

Re: [f2fs-dev] [PATCH V3 6/7] Add decryption support for sub-pagesized blocks

2019-06-21 Thread Eric Biggers
On Sun, Jun 16, 2019 at 09:38:12PM +0530, Chandan Rajendra wrote: > To support decryption of sub-pagesized blocks this commit adds code to, > 1. Track buffer head in "struct read_callbacks_ctx". > 2. Pass buffer head argument to all read callbacks. > 3. Add new fscrypt helper to decrypt the file da

Re: [f2fs-dev] [PATCH V3 4/7] fs/mpage.c: Integrate read callbacks

2019-06-21 Thread Eric Biggers
On Sun, Jun 16, 2019 at 09:38:10PM +0530, Chandan Rajendra wrote: > This commit adds code to make do_mpage_readpage() to be "read callbacks" > aware i.e. for files requiring decryption, do_mpage_readpage() now > sets up the read callbacks state machine when allocating a bio and later > starts execu

Re: [f2fs-dev] [PATCH V3 2/7] Integrate read callbacks into Ext4 and F2FS

2019-06-21 Thread Eric Biggers
Hi Chandan, On Sun, Jun 16, 2019 at 09:38:08PM +0530, Chandan Rajendra wrote: > This commit gets Ext4 and F2FS to make use of read callbacks API to > perform decryption of file data read from the disk. > --- > fs/crypto/bio.c | 30 + > fs/crypto/crypto.c | 1 + > f

Re: [f2fs-dev] [PATCH V3 1/7] FS: Introduce read callbacks

2019-06-21 Thread Eric Biggers
Hi Chandan, On Sun, Jun 16, 2019 at 09:38:07PM +0530, Chandan Rajendra wrote: > Read callbacks implements a state machine to be executed after a > buffered read I/O is completed. They help in further processing the file > data read from the backing store. Currently, decryption is the only post > p

[f2fs-dev] [PATCH] f2fs: add wsync_mode for sysfs entry

2019-06-21 Thread Jaegeuk Kim
From: Jaegeuk Kim This add one sysfs entry to control REQ_SYNC/REQ_BACKGROUND for write bios for data page writes. Signed-off-by: Jaegeuk Kim --- Documentation/ABI/testing/sysfs-fs-f2fs | 7 +++ Documentation/filesystems/f2fs.txt | 4 fs/f2fs/data.c |

Re: [PATCH -next] f2fs: Use div_u64*() for 64-bit divisions

2019-06-21 Thread Jaegeuk Kim
On 06/21, Geert Uytterhoeven wrote: > Hi Chao, > > On Fri, Jun 21, 2019 at 11:54 AM Chao Yu wrote: > > Since the original patch hasn't been merged to upstream, I think we can > > merge > > this into original patch, how do you think? > > Thanks, that's fine for me. Merged the fix. Thank you so

Re: [f2fs-dev] [PATCH v3] f2fs: add a rw_sem to cover quota flag changes

2019-06-21 Thread Jaegeuk Kim
On 06/21, Jaegeuk Kim wrote: > On 06/20, Chao Yu wrote: > > On 2019/6/20 1:26, Jaegeuk Kim wrote: > > > On 06/18, Chao Yu wrote: > > >> On 2019/6/14 10:46, Jaegeuk Kim wrote: > > >>> On 06/11, Chao Yu wrote: > > On 2019/6/5 2:36, Jaegeuk Kim wrote: > > > Two paths to update quota and f2fs_

Re: [f2fs-dev] [PATCH v3] f2fs: add a rw_sem to cover quota flag changes

2019-06-21 Thread Jaegeuk Kim
On 06/20, Chao Yu wrote: > On 2019/6/20 1:26, Jaegeuk Kim wrote: > > On 06/18, Chao Yu wrote: > >> On 2019/6/14 10:46, Jaegeuk Kim wrote: > >>> On 06/11, Chao Yu wrote: > On 2019/6/5 2:36, Jaegeuk Kim wrote: > > Two paths to update quota and f2fs_lock_op: > > > > 1. > > - lock

Re: [PATCH 1/2] f2fs: use generic EFSBADCRC/EFSCORRUPTED

2019-06-21 Thread Pavel Machek
On Thu 2019-06-20 11:36:14, Chao Yu wrote: > f2fs uses EFAULT as error number to indicate filesystem is corrupted > all the time, but generic filesystems use EUCLEAN for such condition, > we need to change to follow others. > > This patch adds two new macros as below to wrap more generic error > c

Re: [PATCH 2/2] f2fs: set SBI_NEED_FSCK for xattr corruption case

2019-06-21 Thread Pavel Machek
On Thu 2019-06-20 11:36:15, Chao Yu wrote: > If xattr is corrupted, let's print kernel message and set SBI_NEED_FSCK > for further repair. > > Reported-by: Pavel Machek > Signed-off-by: Chao Yu Acked-by: Pavel Machek -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) htt

Re: [PATCH] fsf2: Use DIV_ROUND_UP() instead of open-coding

2019-06-21 Thread Chao Yu
fsf2: Use DIV_ROUND_UP() instead of open-coding fsf2 -> f2fs Otherwise, it looks good to me. Reviewed-by: Chao Yu Thanks, On 2019/6/20 22:42, Geert Uytterhoeven wrote: > Replace the open-coded divisions with round-up by calls to the > DIV_ROUND_UP() helper macro. > > Signed-off-by: Geert Uyt

Re: [f2fs-dev] [PATCH -next] f2fs: Use div_u64*() for 64-bit divisions

2019-06-21 Thread Geert Uytterhoeven
Hi Chao, On Fri, Jun 21, 2019 at 11:54 AM Chao Yu wrote: > Since the original patch hasn't been merged to upstream, I think we can merge > this into original patch, how do you think? Thanks, that's fine for me. > On 2019/6/20 22:38, Geert Uytterhoeven wrote: > > On 32-bit (e.g. m68k): > > > >

Re: [f2fs-dev] [PATCH -next] f2fs: Use div_u64*() for 64-bit divisions

2019-06-21 Thread Chao Yu
Hi Geert, Since the original patch hasn't been merged to upstream, I think we can merge this into original patch, how do you think? On 2019/6/20 22:38, Geert Uytterhoeven wrote: > On 32-bit (e.g. m68k): > > fs/f2fs/gc.o: In function `f2fs_resize_fs': > gc.c:(.text+0x3056): undefined refe