mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Bridges <icb@fastmail.org>
To: koray.fra@gmail.com, linkinjeon@kernel.org
Cc: senozhatsky@chromium.org, tom@talpey.com,
	chenxiaosong@chenxiaosong.com, hyc.lee@gmail.com,
	linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ian Bridges <icb@fastmail.org>
Subject: Re: [PATCH v2] ksmbd: decode and honor DOS attribute validity flags
Date: Sat, 14 Nov 2026 21:07:07 -0600	[thread overview]
Message-ID: <20261115030707.2275633-1-icb@fastmail.org> (raw)
In-Reply-To: <DMVECM7B14I1.3GF2HZB9KRUX@gmail.com>

On Sun Nov 15, 2026 at 2:34 AM CET, koraynilay wrote:
> Hello, so I should include the legacy handling in this same patch and
> separate the bugfix for sparse/compression in another one?

One option might be to keep it all in this patch, with a few changes
so that it stays compatible with the xattrs older ksmbd has already
stored.

When sparse or compression updates an existing xattr, it keeps the
creation time, but ndr_decode_dos_attr() discards the flags. The
writer then stores the time with only XATTR_DOSINFO_ATTRIB set.
Checking CREATE_TIME on read would hide creation times that ksmbd
reports today.

Your changes to decode the flags and keep the existing fields are
useful. On top of those, something like this might work.

- Read the stored attributes unconditionally, including a value of 0.
  Samba also reads the attributes without checking ATTRIB.

- Use a non-zero stored creation time even when CREATE_TIME is clear,
  and fall back to the filesystem timestamp when it is 0. A comment
  could explain that older ksmbd writers lost the flag.

- When rewriting an xattr, preserve the other fields and flags, set
  ATTRIB, and restore CREATE_TIME if the time being written is non-zero.

> The problem I had found when trying this approach (I originally wanted
> to send PATCH 1/2 to fix sparse/compression and 2/2 for the decode/read
> fixes) is that with only the sparse/compression patch applied, ksmbd
> clobbers the time on reading by reporting 0, since it doesn't check
> the flags and reads the timestamp anyway.

With the reader change in the same patch, a creation time of 0 would
select the filesystem timestamp. That handles attribute-only xattrs,
but it would not make the writer change safe to apply on its own.

> Please tell me if I wasn't clear, this patch/bug is quite confusing for
> me since it touches a few bugs and they all depend on each other.
> (And one fix introduces another bug fixed by the next fix).

Keeping the current no-xattr initialization would avoid that ordering
problem altogether. We could fix preservation of existing xattrs here
and consider changing newly written xattrs separately.

It might also be best to leave changes to ITIME validity policy out of
this fix. I don't think ksmbd uses the itime for anything it reports, so
those changes would not affect this bug.

Namjae, would accepting a non-zero creation time despite a missing
flag be a reasonable compatibility rule for existing ksmbd xattrs?

Thanks,
Ian

      reply	other threads:[~2026-11-15  3:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14  1:27 koraynilay
2026-11-14 16:03 ` Ian Bridges
2026-11-15  0:22   ` Namjae Jeon
2026-11-15  1:34     ` koraynilay
2026-11-15  3:07       ` Ian Bridges [this message]

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=20261115030707.2275633-1-icb@fastmail.org \
    --to=icb@fastmail.org \
    --cc=chenxiaosong@chenxiaosong.com \
    --cc=hyc.lee@gmail.com \
    --cc=koray.fra@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=tom@talpey.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

all inboxes | Powered by JetHome®