Re: [f2fs-dev] [PATCH 1/2] add configure option --with-root-libdir

2018-08-27 Thread Chao Yu
On 2018/8/20 11:04, Theodore Ts'o wrote:
> This allows the development link libraries to be installed in
> /usr/lib, while the run-libraries are installed in /lib, which is
> required by Debian policy.  This can be done via:
> 
> configure --prefix=/ --libdir=/usr/lib --with-root-libdir=/lib
> 
> The technique of working around libtool's inflexibility is borrowed
> from util-linux.
> 
> Signed-off-by: Theodore Ts'o 

Reviewed-by: Chao Yu 

Thanks,


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH] build: declare that libf2fs_format uses the blkid library

2018-08-27 Thread Chao Yu
On 2018/8/24 15:26, Theodore Ts'o wrote:
> Signed-off-by: Theodore Ts'o 

Reviewed-by: Chao Yu 


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH 1/2] add configure option --with-root-libdir

2018-08-27 Thread Theodore Y. Ts'o
On Mon, Aug 27, 2018 at 09:57:44AM -0700, Jaegeuk Kim wrote:
> 
> Thanks. I've added this and been testing with other patches for next release.
>

Are you planning on doing a new release soon?

I'm also wondering if you could give some color commentary on how
often you plan on bumping the shared version library numbers?  The
reason why I ask is because there is a Debian package which depends on
libf2fs and libf2fs-format, android-libf2fs-utils.  It appears to be
part of the Android SDK.

I was about to send the Debian maintainer of android-libf2fs-utils
package a ping asking him or her to relink against the latest so
versions --- libf2fs.so.5 and libf2fs-format.so.4.  But if the next
release is going to involve a bump of the so versions again, I'll hold
off requesting a rebuild of the package.

And if the shared libraries are going to be regularly bumped due to
incompatible ABI changes, should I recommend the andorid-f2fs-utils to
statically link instead of link against the f2fs shared libraries?

(I haven't bumped the e2fsprogs so versions in over a decade, but
that's because I had carefully designed the interfaces to allow for
backwards compatibility as we added new features to the file system.
I didn't know if that was part of your plan for f2fs-tools)

Thanks!!

- Ted

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH] f2fs: avoid wrong decrypted data from disk

2018-08-27 Thread Jaegeuk Kim
1. Create a file in an encrypted directory
2. Do GC & drop caches
3. Read stale data before its bio for metapage was not issued yet

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/data.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 382c1ef9a9e4..c3557fd4a0bd 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1550,6 +1550,13 @@ static int f2fs_mpage_readpages(struct address_space 
*mapping,
bio = NULL;
}
if (bio == NULL) {
+   /*
+* If the page is under writeback, we need to wait for
+* its completion to see the correct decrypted data.
+*/
+   if (unlikely(f2fs_encrypted_file(inode)))
+   f2fs_wait_on_block_writeback(F2FS_I_SB(inode), 
block_nr);
+
bio = f2fs_grab_read_bio(inode, block_nr, nr_pages,
is_readahead ? REQ_RAHEAD : 0);
if (IS_ERR(bio)) {
-- 
2.17.0.441.gb46fe60e1d-goog


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] WARNING: ODEBUG bug in f2fs_fill_super

2018-08-27 Thread syzbot

Hello,

syzbot found the following crash on:

HEAD commit:e27bc174c9c6 Add linux-next specific files for 20180824
git tree:   linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=11c0034a40
kernel config:  https://syzkaller.appspot.com/x/.config?x=28446088176757ea
dashboard link: https://syzkaller.appspot.com/bug?extid=77ea19d309d4cdc55cc1
compiler:   gcc (GCC) 8.0.1 20180413 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+77ea19d309d4cdc55...@syzkaller.appspotmail.com

[ cut here ]
ODEBUG: free active (active state 0) object type: percpu_counter  
hint:   (null)
WARNING: CPU: 1 PID: 18832 at lib/debugobjects.c:329  
debug_print_object+0x16a/0x210 lib/debugobjects.c:326

Kernel panic - not syncing: panic_on_warn set ...

CPU: 1 PID: 18832 Comm: syz-executor4 Not tainted 4.18.0-next-20180824+ #47
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1c9/0x2b4 lib/dump_stack.c:113
 panic+0x238/0x4e7 kernel/panic.c:184
 __warn.cold.8+0x163/0x1ba kernel/panic.c:536
 report_bug+0x252/0x2d0 lib/bug.c:186
 fixup_bug arch/x86/kernel/traps.c:178 [inline]
 do_error_trap+0x1fc/0x4d0 arch/x86/kernel/traps.c:296
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:316
 invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:996
RIP: 0010:debug_print_object+0x16a/0x210 lib/debugobjects.c:326
Code: 3a 87 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 92 00 00 00 48 8b 14 dd  
20 e5 3a 87 4c 89 f6 48 c7 c7 c0 da 3a 87 e8 26 ec e3 fd <0f> 0b 83 05 a9  
49 28 05 01 48 83 c4 18 5b 41 5c 41 5d 41 5e 41 5f

RSP: 0018:8801a9a97360 EFLAGS: 00010082
RAX:  RBX: 0003 RCX: c90012037000
RDX: 0002cd2b RSI: 8163b051 RDI: 0001
RBP: 8801a9a973a0 R08: 8801c1f76100 R09: ed003b623eca
R10: ed003b623eca R11: 8801db11f657 R12: 0001
R13: 882b7ae0 R14: 873adf60 R15: 
 __debug_check_no_obj_freed lib/debugobjects.c:786 [inline]
 debug_check_no_obj_freed+0x3b2/0x595 lib/debugobjects.c:818
 kfree+0xc7/0x210 mm/slab.c:3812
 f2fs_fill_super+0xe1a/0x8150 fs/f2fs/super.c:3147
 mount_bdev+0x314/0x3e0 fs/super.c:1347
 f2fs_mount+0x3c/0x50 fs/f2fs/super.c:3161
 legacy_get_tree+0x131/0x460 fs/fs_context.c:732
 vfs_get_tree+0x1cb/0x5c0 fs/super.c:1746
 do_new_mount fs/namespace.c:2627 [inline]
 do_mount+0x6f9/0x1e30 fs/namespace.c:2951
 ksys_mount+0x12d/0x140 fs/namespace.c:3167
 __do_sys_mount fs/namespace.c:3181 [inline]
 __se_sys_mount fs/namespace.c:3178 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3178
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459aba
Code: b8 a6 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 bd 8a fb ff c3 66 2e 0f  
1f 84 00 00 00 00 00 66 90 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 9a 8a fb ff c3 66 0f 1f 84 00 00 00 00 00

RSP: 002b:7f16f9937a88 EFLAGS: 0206 ORIG_RAX: 00a5
RAX: ffda RBX: 7f16f9937b30 RCX: 00459aba
RDX: 7f16f9937ad0 RSI: 2100 RDI: 7f16f9937af0
RBP: 2100 R08: 7f16f9937b30 R09: 7f16f9937ad0
R10:  R11: 0206 R12: 0003
R13:  R14: 004c9c12 R15: 

==
WARNING: possible circular locking dependency detected
4.18.0-next-20180824+ #47 Not tainted
--
syz-executor4/18832 is trying to acquire lock:
cd8e7eb7 ((console_sem).lock){-.-.}, at: down_trylock+0x13/0x70  
kernel/locking/semaphore.c:136


but task is already holding lock:
46ad1dd4 (_hash[i].lock){-.-.}, at: __debug_check_no_obj_freed  
lib/debugobjects.c:777 [inline]
46ad1dd4 (_hash[i].lock){-.-.}, at:  
debug_check_no_obj_freed+0x16c/0x595 lib/debugobjects.c:818


which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (_hash[i].lock){-.-.}:
   __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
   _raw_spin_lock_irqsave+0x96/0xc0 kernel/locking/spinlock.c:152
   __debug_object_init+0x127/0x12e0 lib/debugobjects.c:384
   debug_object_init+0x16/0x20 lib/debugobjects.c:432
   debug_hrtimer_init kernel/time/hrtimer.c:410 [inline]
   debug_init kernel/time/hrtimer.c:458 [inline]
   hrtimer_init+0x97/0x410 kernel/time/hrtimer.c:1308
   init_dl_task_timer+0x1b/0x50 kernel/sched/deadline.c:1057
   __sched_fork+0x2ae/0x590 kernel/sched/core.c:2160
   init_idle+0x75/0x740 kernel/sched/core.c:5377
   sched_init+0xbee/0xcbd kernel/sched/core.c:6060
   start_kernel+0x47d/0x94e init/main.c:602
   

Re: [f2fs-dev] [PATCH 1/2] add configure option --with-root-libdir

2018-08-27 Thread Jaegeuk Kim
On 08/27, Theodore Y. Ts'o wrote:
> On Sun, Aug 19, 2018 at 11:04:06PM -0400, Theodore Ts'o wrote:
> > This allows the development link libraries to be installed in
> > /usr/lib, while the run-libraries are installed in /lib, which is
> > required by Debian policy.  This can be done via:
> > 
> > configure --prefix=/ --libdir=/usr/lib --with-root-libdir=/lib
> > 
> > The technique of working around libtool's inflexibility is borrowed
> > from util-linux.
> > 
> > Signed-off-by: Theodore Ts'o 
> 
> Ping?  This is needed (and is applied) for the Debian packaging of
> f2fs-tools.  See patch #0001 at:

Thanks. I've added this and been testing with other patches for next release.

> 
> https://salsa.debian.org/debian/f2fs-tools/tree/master/debian/patches
> 
>   - Ted
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH] build: declare that libf2fs_format uses the blkid library

2018-08-27 Thread Jaegeuk Kim
On 08/27, Theodore Y. Ts'o wrote:
> Ping?  This bug was noticed when I was repackaging f2fs-tools for
> Debian.  The problem is that libf2fs_format references the blkid
> library, and Debian's shared library auditing tools noticed the
> missing library dependency.

Hi Ted,

Thank you for the fix. I added it in my local tree for testing for a while.
Let me think about next release having this.

Thanks,

> 
>   - Ted
> 
> On Fri, Aug 24, 2018 at 03:26:32AM -0400, Theodore Ts'o wrote:
> > Signed-off-by: Theodore Ts'o 
> > ---
> >  mkfs/Makefile.am | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/mkfs/Makefile.am b/mkfs/Makefile.am
> > index 32996ba..cae2f93 100644
> > --- a/mkfs/Makefile.am
> > +++ b/mkfs/Makefile.am
> > @@ -12,7 +12,7 @@ lib_LTLIBRARIES = libf2fs_format.la
> >  libf2fs_format_la_SOURCES = f2fs_format_main.c f2fs_format.c 
> > f2fs_format_utils.c
> >  libf2fs_format_la_CFLAGS = -DWITH_BLKDISCARD
> >  libf2fs_format_la_CPPFLAGS = -I$(top_srcdir)/include
> > -libf2fs_format_la_LDFLAGS = -luuid -L$(top_builddir)/lib -lf2fs \
> > +libf2fs_format_la_LDFLAGS = -lblkid -luuid -L$(top_builddir)/lib -lf2fs \
> > -version-info $(FMT_CURRENT):$(FMT_REVISION):$(FMT_AGE)
> >  
> >  install-exec-hook:
> > -- 
> > 2.18.0.rc0
> > 
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH] build: declare that libf2fs_format uses the blkid library

2018-08-27 Thread Theodore Y. Ts'o
Ping?  This bug was noticed when I was repackaging f2fs-tools for
Debian.  The problem is that libf2fs_format references the blkid
library, and Debian's shared library auditing tools noticed the
missing library dependency.

- Ted

On Fri, Aug 24, 2018 at 03:26:32AM -0400, Theodore Ts'o wrote:
> Signed-off-by: Theodore Ts'o 
> ---
>  mkfs/Makefile.am | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mkfs/Makefile.am b/mkfs/Makefile.am
> index 32996ba..cae2f93 100644
> --- a/mkfs/Makefile.am
> +++ b/mkfs/Makefile.am
> @@ -12,7 +12,7 @@ lib_LTLIBRARIES = libf2fs_format.la
>  libf2fs_format_la_SOURCES = f2fs_format_main.c f2fs_format.c 
> f2fs_format_utils.c
>  libf2fs_format_la_CFLAGS = -DWITH_BLKDISCARD
>  libf2fs_format_la_CPPFLAGS = -I$(top_srcdir)/include
> -libf2fs_format_la_LDFLAGS = -luuid -L$(top_builddir)/lib -lf2fs \
> +libf2fs_format_la_LDFLAGS = -lblkid -luuid -L$(top_builddir)/lib -lf2fs \
>   -version-info $(FMT_CURRENT):$(FMT_REVISION):$(FMT_AGE)
>  
>  install-exec-hook:
> -- 
> 2.18.0.rc0
> 

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [RFC PATCH 10/10] f2fs: fs-verity support

2018-08-27 Thread Chao Yu
Hi Eric,

On 2018/8/27 1:35, Eric Biggers wrote:
> Hi Chao,
> 
> On Sat, Aug 25, 2018 at 01:54:08PM +0800, Chao Yu wrote:
>> On 2018/8/25 0:16, Eric Biggers wrote:
>>> From: Eric Biggers 
>>>  #ifdef CONFIG_F2FS_CHECK_FS
>>>  #define f2fs_bug_on(sbi, condition)BUG_ON(condition)
>>>  #else
>>> @@ -146,7 +149,7 @@ struct f2fs_mount_info {
>>>  #define F2FS_FEATURE_QUOTA_INO 0x0080
>>>  #define F2FS_FEATURE_INODE_CRTIME  0x0100
>>>  #define F2FS_FEATURE_LOST_FOUND0x0200
>>> -#define F2FS_FEATURE_VERITY0x0400  /* reserved */
>>> +#define F2FS_FEATURE_VERITY0x0400
>>>  
>>>  #define F2FS_HAS_FEATURE(sb, mask) \
>>> ((F2FS_SB(sb)->raw_super->feature & cpu_to_le32(mask)) != 0)
>>> @@ -598,7 +601,7 @@ enum {
>>>  #define FADVISE_ENC_NAME_BIT   0x08
>>>  #define FADVISE_KEEP_SIZE_BIT  0x10
>>>  #define FADVISE_HOT_BIT0x20
>>> -#define FADVISE_VERITY_BIT 0x40/* reserved */
>>> +#define FADVISE_VERITY_BIT 0x40
>>
>> As I suggested before, how about moving f2fs' verity_bit from i_fadvise to 
>> more
>> generic i_flags field like ext4, so we can a) remaining more bits for those
>> demands which really need file advise fields. b) using i_flags bits keeping 
>> line
>> with ext4. Not sure, if user want to know whether the file is verity one, it
>> will be easy for f2fs to export the status through FS_IOC_SETFLAGS.
>>
>> #define EXT4_VERITY_FL   0x0010 /* Verity protected 
>> inode */
>>
>> #define F2FS_VERITY_FL   0x0010 /* Verity protected 
>> inode */
>>
> 
> I don't like using i_advise much either, but I actually don't see either
> location being much better than the other at the moment.  The real problem is 
> an
> artificial one: the i_flags in f2fs's on-disk format are being assumed to use

Yeah, but since most copied flags from vfs/ext4 are not actually used in f2fs,
also 0x0010 bit is not used now, so we can just define it now directly for
verity bit.

Cleanup and remapping in ioctl interface for those unused flags, we can do it
latter?

Thanks,

> the same numbering scheme as ext4's on-disk format, which makes it seem that
> they have to be in sync, and that all new ext4 flags (say, EA_INODE) also
> reserve bits in f2fs and vice versa, when they in fact do not.  Instead, f2fs
> should use its own numbering for its i_flags, and it should map them to/from
> whatever is needed for common APIs like FS_IOC_{GET,SET}FLAGS and
> FS_IOC_FS{GET,SET}XATTR.
> 
> So putting the verity flag in *either* location (i_advise or i_flags) is just
> kicking the can down the road.  If I get around to it I will send a patch that
> cleans up the f2fs flags properly...>
> Thanks,
> 
> - Eric
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> 

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [RFC PATCH RESEND 1/4] f2fs: support superblock checksum

2018-08-27 Thread Junling Zheng
Ping...

On 2018/8/14 14:56, Junling Zheng wrote:
> Now we support crc32 checksum for superblock.
> 
> Reviewed-by: Chao Yu 
> Signed-off-by: Junling Zheng 
> ---
>  fs/f2fs/f2fs.h  |  2 ++
>  fs/f2fs/super.c | 29 +
>  fs/f2fs/sysfs.c |  7 +++
>  include/linux/f2fs_fs.h |  3 ++-
>  4 files changed, 40 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 4525f4f82af0..d50d6efda96b 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -147,6 +147,7 @@ struct f2fs_mount_info {
>  #define F2FS_FEATURE_INODE_CRTIME0x0100
>  #define F2FS_FEATURE_LOST_FOUND  0x0200
>  #define F2FS_FEATURE_VERITY  0x0400  /* reserved */
> +#define F2FS_FEATURE_SB_CHKSUM   0x0800
>  
>  #define F2FS_HAS_FEATURE(sb, mask)   \
>   ((F2FS_SB(sb)->raw_super->feature & cpu_to_le32(mask)) != 0)
> @@ -3376,6 +3377,7 @@ F2FS_FEATURE_FUNCS(flexible_inline_xattr, 
> FLEXIBLE_INLINE_XATTR);
>  F2FS_FEATURE_FUNCS(quota_ino, QUOTA_INO);
>  F2FS_FEATURE_FUNCS(inode_crtime, INODE_CRTIME);
>  F2FS_FEATURE_FUNCS(lost_found, LOST_FOUND);
> +F2FS_FEATURE_FUNCS(sb_chksum, SB_CHKSUM);
>  
>  #ifdef CONFIG_BLK_DEV_ZONED
>  static inline int get_blkz_type(struct f2fs_sb_info *sbi,
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index bd57be470e23..3ffc336caea8 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -2149,6 +2149,26 @@ static int sanity_check_raw_super(struct f2fs_sb_info 
> *sbi,
>   (bh->b_data + F2FS_SUPER_OFFSET);
>   struct super_block *sb = sbi->sb;
>   unsigned int blocksize;
> + size_t crc_offset = 0;
> + __u32 crc = 0;
> +
> + /* Check checksum_offset and crc in superblock */
> + if (le32_to_cpu(raw_super->feature) & F2FS_FEATURE_SB_CHKSUM) {
> + crc_offset = le32_to_cpu(raw_super->checksum_offset);
> + if (crc_offset !=
> + offsetof(struct f2fs_super_block, crc)) {
> + f2fs_msg(sb, KERN_INFO,
> + "Invalid SB checksum offset: %zu",
> + crc_offset);
> + return 1;
> + }
> + crc = le32_to_cpu(raw_super->crc);
> + if (!f2fs_crc_valid(sbi, crc, raw_super, crc_offset)) {
> + f2fs_msg(sb, KERN_INFO,
> + "Invalid SB checksum value: %u", crc);
> + return 1;
> + }
> + }
>  
>   if (F2FS_SUPER_MAGIC != le32_to_cpu(raw_super->magic)) {
>   f2fs_msg(sb, KERN_INFO,
> @@ -2568,6 +2588,7 @@ static int read_raw_super_block(struct f2fs_sb_info 
> *sbi,
>  int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover)
>  {
>   struct buffer_head *bh;
> + __u32 crc = 0;
>   int err;
>  
>   if ((recover && f2fs_readonly(sbi->sb)) ||
> @@ -2576,6 +2597,13 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool 
> recover)
>   return -EROFS;
>   }
>  
> + /* we should update superblock crc here */
> + if (!recover && f2fs_sb_has_sb_chksum(sbi->sb)) {
> + crc = f2fs_crc32(sbi, F2FS_RAW_SUPER(sbi),
> + offsetof(struct f2fs_super_block, crc));
> + F2FS_RAW_SUPER(sbi)->crc = cpu_to_le32(crc);
> + }
> +
>   /* write back-up superblock first */
>   bh = sb_bread(sbi->sb, sbi->valid_super_block ? 0 : 1);
>   if (!bh)
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index cd2e030e47b8..c86d91be6c48 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -120,6 +120,9 @@ static ssize_t features_show(struct f2fs_attr *a,
>   if (f2fs_sb_has_lost_found(sb))
>   len += snprintf(buf + len, PAGE_SIZE - len, "%s%s",
>   len ? ", " : "", "lost_found");
> + if (f2fs_sb_has_sb_chksum(sb))
> + len += snprintf(buf + len, PAGE_SIZE - len, "%s%s",
> + len ? ", " : "", "sb_checksum");
>   len += snprintf(buf + len, PAGE_SIZE - len, "\n");
>   return len;
>  }
> @@ -337,6 +340,7 @@ enum feat_id {
>   FEAT_QUOTA_INO,
>   FEAT_INODE_CRTIME,
>   FEAT_LOST_FOUND,
> + FEAT_SB_CHECKSUM,
>  };
>  
>  static ssize_t f2fs_feature_show(struct f2fs_attr *a,
> @@ -353,6 +357,7 @@ static ssize_t f2fs_feature_show(struct f2fs_attr *a,
>   case FEAT_QUOTA_INO:
>   case FEAT_INODE_CRTIME:
>   case FEAT_LOST_FOUND:
> + case FEAT_SB_CHECKSUM:
>   return snprintf(buf, PAGE_SIZE, "supported\n");
>   }
>   return 0;
> @@ -433,6 +438,7 @@ F2FS_FEATURE_RO_ATTR(flexible_inline_xattr, 
> FEAT_FLEXIBLE_INLINE_XATTR);
>  F2FS_FEATURE_RO_ATTR(quota_ino, FEAT_QUOTA_INO);
>  F2FS_FEATURE_RO_ATTR(inode_crtime, FEAT_INODE_CRTIME);
>  F2FS_FEATURE_RO_ATTR(lost_found, FEAT_LOST_FOUND);
> +F2FS_FEATURE_RO_ATTR(sb_checksum, FEAT_SB_CHECKSUM);
>  
>  

Re: [f2fs-dev] [PATCH 1/2] add configure option --with-root-libdir

2018-08-27 Thread Theodore Y. Ts'o
On Sun, Aug 19, 2018 at 11:04:06PM -0400, Theodore Ts'o wrote:
> This allows the development link libraries to be installed in
> /usr/lib, while the run-libraries are installed in /lib, which is
> required by Debian policy.  This can be done via:
> 
> configure --prefix=/ --libdir=/usr/lib --with-root-libdir=/lib
> 
> The technique of working around libtool's inflexibility is borrowed
> from util-linux.
> 
> Signed-off-by: Theodore Ts'o 

Ping?  This is needed (and is applied) for the Debian packaging of
f2fs-tools.  See patch #0001 at:

https://salsa.debian.org/debian/f2fs-tools/tree/master/debian/patches

- Ted

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [Bug 200951] kernel NULL pointer dereference in update_sit_entry

2018-08-27 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=200951

--- Comment #2 from vice...@gmail.com ---
Created attachment 278131
  --> https://bugzilla.kernel.org/attachment.cgi?id=278131=edit
sg_vpd

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [Bug 200951] kernel NULL pointer dereference in update_sit_entry

2018-08-27 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=200951

--- Comment #1 from vice...@gmail.com ---
Created attachment 278129
  --> https://bugzilla.kernel.org/attachment.cgi?id=278129=edit
sg_readcap

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [Bug 200951] New: kernel NULL pointer dereference in update_sit_entry

2018-08-27 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=200951

Bug ID: 200951
   Summary: kernel NULL pointer dereference in update_sit_entry
   Product: File System
   Version: 2.5
Kernel Version: v4.19-rc1, v4.18.2
  Hardware: ARM
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: high
  Priority: P1
 Component: f2fs
  Assignee: filesystem_f...@kernel-bugs.kernel.org
  Reporter: vice...@gmail.com
Regression: No

Created attachment 278127
  --> https://bugzilla.kernel.org/attachment.cgi?id=278127=edit
dmesg

Hi,
in the setup there is a SATA SSD connected to a SATA-to-USB bridge.

The disc is "Samsung SSD 850 PRO 256G" which supports TRIM.
There are four partitions:
 sda1: FAT  /boot
 sda2: F2FS /
 sda3: F2FS /home
 sda4: F2FS

The bridge is ASMT1153e which uses the "uas" driver.
There is no TRIM pass-through, so, when mounting it reports:
 mounting with "discard" option, but the device does not support discard

The USB host is USB3.0 and UASP capable. It is the one on RK3399.

Given this everything works fine, except there is no TRIM support.

In order to enable TRIM a new UDEV rule is added [1]:
 /etc/udev/rules.d/10-sata-bridge-trim.rules:
 ACTION=="add|change", ATTRS{idVendor}=="174c", ATTRS{idProduct}=="55aa",
SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"
After reboot any F2FS write hangs forever and dmesg reports:
 Unable to handle kernel NULL pointer dereference

Also tested on a x86_64 system: works fine even with TRIM enabled.
 same disc
 same bridge
 different usb host controller
 different cpu architecture
 not root filesystem

Regards,
  Vicenç.

[1] Post #5 in https://bbs.archlinux.org/viewtopic.php?id=236280

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel