Linux filesystem development
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: wangzijie <wangzijie1@honor.com>,
	rick.p.edgecombe@intel.com, ast@kernel.org, adobriyan@gmail.com,
	kirill.shutemov@linux.intel.com, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] proc: clear FMODE_LSEEK flag correctly for permanent pde
Date: Thu, 5 Jun 2025 20:44:42 -0700	[thread overview]
Message-ID: <20250605204442.4a2e98b8feb6fc3603375b66@linux-foundation.org> (raw)
In-Reply-To: <20250606015621.GO299672@ZenIV>

On Fri, 6 Jun 2025 02:56:21 +0100 Al Viro <viro@zeniv.linux.org.uk> wrote:

> On Thu, Jun 05, 2025 at 02:44:15PM -0700, Andrew Morton wrote:
> > On Thu, 5 Jun 2025 14:52:52 +0800 wangzijie <wangzijie1@honor.com> wrote:
> > 
> > > Clearing FMODE_LSEEK flag should not rely on whether proc_open ops exists,
> > 
> > Why is this?
> > 
> > > fix it.
> > 
> > What are the consequences of the fix?  Is there presently some kernel
> > misbehavior?
> 
> At a guess, that would be an oops due to this:
>         if (pde_is_permanent(pde)) {
> 		return pde->proc_ops->proc_lseek(file, offset, whence);
> 	} else if (use_pde(pde)) {
> 		rv = pde->proc_ops->proc_lseek(file, offset, whence);
> 		unuse_pde(pde);
> 	}
> in proc_reg_llseek().  No FMODE_LSEEK == "no seeks for that file, just
> return -ESPIPE".  It is set by do_dentry_open() if you have NULL
> ->llseek() in ->f_op; the reason why procfs needs to adjust that is
> the it has uniform ->llseek, calling the underlying method for that 
> proc_dir_entry.  So if it's NULL, we need ->open() (also uniform,
> proc_reg_open() for all of those) to clear FMODE_LSEEK from ->f_mode.
> 
> The thing I don't understand is where the hell had proc_reg_open()
> changed in that way - commit refered in the patch doesn't exist in
> mainline, doesn't seem to be in -next or -stable either.

It's a fix against the very recently merged
https://lkml.kernel.org/r/20250528034756.4069180-1-wangzijie1@honor.com.

  parent reply	other threads:[~2025-06-06  3:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05  6:52 [PATCH] proc: clear FMODE_LSEEK flag correctly for permanent pde wangzijie
2025-06-05 21:44 ` Andrew Morton
2025-06-06  1:56   ` Al Viro
2025-06-06  2:37     ` wangzijie
2025-06-06  3:57       ` Al Viro
2025-06-06  4:01         ` Andrew Morton
2025-06-06  5:13         ` wangzijie
2025-06-06  3:34     ` wangzijie
2025-06-06  3:44     ` Andrew Morton [this message]
2025-06-06  3:58       ` Al Viro

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=20250605204442.4a2e98b8feb6fc3603375b66@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=adobriyan@gmail.com \
    --cc=ast@kernel.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wangzijie1@honor.com \
    /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