Re: Issue with JFFS2 and a_ops->dirty_folio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Christoph,

On 13/06/2024 13:20, Christoph Hellwig wrote:
On Thu, Jun 13, 2024 at 09:05:17AM +0200, Jean-Michel Hautbois wrote:
Hi everyone !

I am currently working on a Coldfire (MPC54418) and quite everything goes
well, except that I can only execute one command from user space before
getting a segmentation fault on the do_exit() syscall.

Looks like jffs2 is simply missing a dirty_folio implementation.  The
simple filemap_dirty_folio should do the job, please try the patch
below:


diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
index 62ea76da7fdf23..7124cbad6c35ae 100644
--- a/fs/jffs2/file.c
+++ b/fs/jffs2/file.c
@@ -19,6 +19,7 @@
  #include <linux/highmem.h>
  #include <linux/crc32.h>
  #include <linux/jffs2.h>
+#include <linux/writeback.h>
  #include "nodelist.h"
static int jffs2_write_end(struct file *filp, struct address_space *mapping,
@@ -75,6 +76,7 @@ const struct address_space_operations jffs2_file_address_operations =
  	.read_folio =	jffs2_read_folio,
  	.write_begin =	jffs2_write_begin,
  	.write_end =	jffs2_write_end,
+	.dirty_folio =	filemap_dirty_folio,
  };
static int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg)


Thanks, I did implement this one, but now I have another weird issue, I don't know if this can be related...

When the bash command is launched (my init command is init=/bin/bash) I can launch a first command (say, ls for instance) and it works fine. But a second call to this same command or any other one juste returns as if nothing was done... And I can't even debug, strace fails too:

execve("/bin/ls", ["/bin/ls"], 0xbfb31ef0 /* 5 vars */) = 0
brk(NULL)                               = 0x2ab7c000
atomic_barrier()                        = 0
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/libresolv.so.2", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\4\0\0\0\1\0\0\0\0\0\0\0004"..., 512) = 512 statx(3, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_TYPE|STATX_MODE|STATX_NLINK|STATX_UID|STATX_GID|STATX_MTIME|STATX_CTIME|STATX_INO|STATX_SIZE|STATX_BLOCKS|STATX_
MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=43120, ...}) = 0
mmap2(NULL, 59888, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =[ 15.830000] random: crng init done
 0x60022000
mmap2(0x6002c000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8000) = 0x6002c000 mmap2(0x60030000, 2544, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x60030000
close(3)                                = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
openat(AT_FDCWD, "/lib/libc.so.6", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\4\0\0\0\1\0\2\324\n\0\0\0004"..., 512) = 512 statx(3, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_TYPE|STATX_MODE|STATX_NLINK|STATX_UID|STATX_GID|STATX_MTIME|STATX_CTIME|STATX_INO|STATX_SIZE|STATX_BLOCKS|STATX_
MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=1257660, ...}) = 0
mmap2(NULL, 1290920, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x60032000 mmap2(0x6015e000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12c000) = 0x6015e000 mmap2(0x60164000, 37544, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x60164000
close(3)                                = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
atomic_barrier()                        = 0
mmap2(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x6016e000
set_thread_area(0x601759c0)             = 0
get_thread_area()                       = 0x601759c0
atomic_barrier()                        = 0
set_tid_address(0x6016e548)             = 28
set_robust_list(0x6016e54c, 12)         = 0
mprotect(0x6015e000, 8192, PROT_READ)   = 0
mprotect(0x6002c000, 8192, PROT_READ)   = 0
mprotect(0x2ab72000, 8192, PROT_READ)   = 0
mprotect(0x6001e000, 8192, PROT_READ)   = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xc00815f4} ---
+++ killed by SIGSEGV +++

I suppose this can be related to the ELF_DT_DYN_BASE address, but I can't see what is going on yet.

Thanks,
JM




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux