linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-mtd@lists.infradead.org, willy@infradead.org,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-m68k@lists.linux-m68k.org
Subject: Re: Issue with JFFS2 and a_ops->dirty_folio
Date: Thu, 13 Jun 2024 14:57:50 +0200	[thread overview]
Message-ID: <ba441a7c-28f8-49c0-95b9-71a586007e44@yoseli.org> (raw)
In-Reply-To: <ZmrV9vLwj0uFj5Dn@infradead.org>

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


  reply	other threads:[~2024-06-13 12:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13  7:05 Jean-Michel Hautbois
2024-06-13 11:20 ` Christoph Hellwig
2024-06-13 12:57   ` Jean-Michel Hautbois [this message]
2024-06-14 10:21   ` Jean-Michel Hautbois

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ba441a7c-28f8-49c0-95b9-71a586007e44@yoseli.org \
    --to=jeanmichel.hautbois@yoseli.org \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox