mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
isofs: Implement fileattr_get for case sensitivity
Upper layers such as NFSD need a way to query whether a filesystem handles filenames in a case-sensitive manner so they can provide correct semantics to remote clients. Without this information, NFS exports of ISO 9660 filesystems cannot advertise their filename case behavior. Implement isofs_fileattr_get() to report ISO 9660 case handling behavior. The 'check=r' (relaxed) mount option enables case-insensitive lookups and is reported via FS_XFLAG_CASEFOLD. By default, Joliet extensions operate in relaxed mode while plain ISO 9660 uses strict (case-sensitive) mode. Plain ISO 9660 names on the medium are uppercase. When neither Rock Ridge nor Joliet is in effect, the default 'map=n' option (and 'map=a') routes lookup and readdir through isofs_name_translate(), which forces A-Z to a-z. The names visible to userspace then differ in case from the on-disc form, so report FS_XFLAG_CASENONPRESERVING in that configuration. Rock Ridge and Joliet both deliver names as authored, and 'map=o' emits the raw on-disc name unchanged, so those configurations remain case-preserving. Casefolding is a directory property, and the in-tree consumers (NFSD, ksmbd) issue the query against a directory: NFSD walks to the parent for non-directory dentries before calling vfs_fileattr_get(), and ksmbd reports per-share attributes from the share root. Wire .fileattr_get only on isofs_dir_inode_operations. The CASEFOLD flag is set in both fa->fsx_xflags and fa->flags so FS_IOC_FSGETXATTR and FS_IOC_GETFLAGS agree. Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Roland Mainz <roland.mainz@nrubsig.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Link: https://patch.msgid.link/20260507-case-sensitivity-v14-12-e62cc8200435@oracle.com Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
ef14aa143f
commit
7bbd51b1d7
|
|
@ -14,6 +14,7 @@
|
|||
#include <linux/gfp.h>
|
||||
#include <linux/filelock.h>
|
||||
#include "isofs.h"
|
||||
#include <linux/fileattr.h>
|
||||
|
||||
int isofs_name_translate(struct iso_directory_record *de, char *new, struct inode *inode)
|
||||
{
|
||||
|
|
@ -267,6 +268,20 @@ static int isofs_readdir(struct file *file, struct dir_context *ctx)
|
|||
return result;
|
||||
}
|
||||
|
||||
int isofs_fileattr_get(struct dentry *dentry, struct file_kattr *fa)
|
||||
{
|
||||
struct isofs_sb_info *sbi = ISOFS_SB(dentry->d_sb);
|
||||
|
||||
if (sbi->s_check == 'r') {
|
||||
fa->fsx_xflags |= FS_XFLAG_CASEFOLD;
|
||||
fa->flags |= FS_CASEFOLD_FL;
|
||||
}
|
||||
if (!sbi->s_joliet_level && !sbi->s_rock &&
|
||||
(sbi->s_mapping == 'n' || sbi->s_mapping == 'a'))
|
||||
fa->fsx_xflags |= FS_XFLAG_CASENONPRESERVING;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct file_operations isofs_dir_operations =
|
||||
{
|
||||
.llseek = generic_file_llseek,
|
||||
|
|
@ -281,6 +296,7 @@ const struct file_operations isofs_dir_operations =
|
|||
const struct inode_operations isofs_dir_inode_operations =
|
||||
{
|
||||
.lookup = isofs_lookup,
|
||||
.fileattr_get = isofs_fileattr_get,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -197,6 +197,9 @@ isofs_normalize_block_and_offset(struct iso_directory_record* de,
|
|||
}
|
||||
}
|
||||
|
||||
struct file_kattr;
|
||||
int isofs_fileattr_get(struct dentry *dentry, struct file_kattr *fa);
|
||||
|
||||
extern const struct inode_operations isofs_dir_inode_operations;
|
||||
extern const struct file_operations isofs_dir_operations;
|
||||
extern const struct address_space_operations isofs_symlink_aops;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user