Skip to content

Commit 64bf6ae

Browse files
committed
Merge tag 'v6.5/vfs.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull misc vfs updates from Christian Brauner: "Miscellaneous features, cleanups, and fixes for vfs and individual fs Features: - Use mode 0600 for file created by cachefilesd so it can be run by unprivileged users. This aligns them with directories which are already created with mode 0700 by cachefilesd - Reorder a few members in struct file to prevent some false sharing scenarios - Indicate that an eventfd is used a semaphore in the eventfd's fdinfo procfs file - Add a missing uapi header for eventfd exposing relevant uapi defines - Let the VFS protect transitions of a superblock from read-only to read-write in addition to the protection it already provides for transitions from read-write to read-only. Protecting read-only to read-write transitions allows filesystems such as ext4 to perform internal writes, keeping writers away until the transition is completed Cleanups: - Arnd removed the architecture specific arch_report_meminfo() prototypes and added a generic one into procfs.h. Note, we got a report about a warning in amdpgpu codepaths that suggested this was bisectable to this change but we concluded it was a false positive - Remove unused parameters from split_fs_names() - Rename put_and_unmap_page() to unmap_and_put_page() to let the name reflect the order of the cleanup operation that has to unmap before the actual put - Unexport buffer_check_dirty_writeback() as it is not used outside of block device aops - Stop allocating aio rings from highmem - Protecting read-{only,write} transitions in the VFS used open-coded barriers in various places. Replace them with proper little helpers and document both the helpers and all barrier interactions involved when transitioning between read-{only,write} states - Use flexible array members in old readdir codepaths Fixes: - Use the correct type __poll_t for epoll and eventfd - Replace all deprecated strlcpy() invocations, whose return value isn't checked with an equivalent strscpy() call - Fix some kernel-doc warnings in fs/open.c - Reduce the stack usage in jffs2's xattr codepaths finally getting rid of this: fs/jffs2/xattr.c:887:1: error: the frame size of 1088 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] royally annoying compilation warning - Use __FMODE_NONOTIFY instead of FMODE_NONOTIFY where an int and not fmode_t is required to avoid fmode_t to integer degradation warnings - Create coredumps with O_WRONLY instead of O_RDWR. There's a long explanation in that commit how O_RDWR is actually a bug which we found out with the help of Linus and git archeology - Fix "no previous prototype" warnings in the pipe codepaths - Add overflow calculations for remap_verify_area() as a signed addition overflow could be triggered in xfstests - Fix a null pointer dereference in sysv - Use an unsigned variable for length calculations in jfs avoiding compilation warnings with gcc 13 - Fix a dangling pipe pointer in the watch queue codepath - The legacy mount option parser provided as a fallback by the VFS for filesystems not yet converted to the new mount api did prefix the generated mount option string with a leading ',' causing issues for some filesystems - Fix a repeated word in a comment in fs.h - autofs: Update the ctime when mtime is updated as mandated by POSIX" * tag 'v6.5/vfs.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (27 commits) readdir: Replace one-element arrays with flexible-array members fs: Provide helpers for manipulating sb->s_readonly_remount fs: Protect reconfiguration of sb read-write from racing writes eventfd: add a uapi header for eventfd userspace APIs autofs: set ctime as well when mtime changes on a dir eventfd: show the EFD_SEMAPHORE flag in fdinfo fs/aio: Stop allocating aio rings from HIGHMEM fs: Fix comment typo fs: unexport buffer_check_dirty_writeback fs: avoid empty option when generating legacy mount string watch_queue: prevent dangling pipe pointer fs.h: Optimize file struct to prevent false sharing highmem: Rename put_and_unmap_page() to unmap_and_put_page() cachefiles: Allow the cache to be non-root init: remove unused names parameter in split_fs_names() jfs: Use unsigned variable for length calculations fs/sysv: Null check to prevent null-ptr-deref bug fs: use UB-safe check for signed addition overflow in remap_verify_area procfs: consolidate arch_report_meminfo declaration fs: pipe: reveal missing function protoypes ...
2 parents 5c1c88c + 2507135 commit 64bf6ae

File tree

40 files changed

+188
-132
lines changed

40 files changed

+188
-132
lines changed

arch/parisc/include/asm/pgtable.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
472472

473473
#define pte_same(A,B) (pte_val(A) == pte_val(B))
474474

475-
struct seq_file;
476-
extern void arch_report_meminfo(struct seq_file *m);
477-
478475
#endif /* !__ASSEMBLY__ */
479476

480477

arch/powerpc/include/asm/pgtable.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ static inline bool is_ioremap_addr(const void *x)
165165

166166
return addr >= IOREMAP_BASE && addr < IOREMAP_END;
167167
}
168-
169-
struct seq_file;
170-
void arch_report_meminfo(struct seq_file *m);
171168
#endif /* CONFIG_PPC64 */
172169

173170
#endif /* __ASSEMBLY__ */

arch/s390/include/asm/pgtable.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ static inline void update_page_count(int level, long count)
4242
atomic_long_add(count, &direct_pages_count[level]);
4343
}
4444

45-
struct seq_file;
46-
void arch_report_meminfo(struct seq_file *m);
47-
4845
/*
4946
* The S390 doesn't have any external MMU info: the kernel page
5047
* tables contain all the necessary information.

arch/s390/mm/pageattr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Author(s): Jan Glauber <[email protected]>
55
*/
66
#include <linux/hugetlb.h>
7+
#include <linux/proc_fs.h>
78
#include <linux/vmalloc.h>
89
#include <linux/mm.h>
910
#include <asm/cacheflush.h>

arch/x86/include/asm/pgtable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
extern pgd_t early_top_pgt[PTRS_PER_PGD];
2828
bool __init __early_make_pgtable(unsigned long address, pmdval_t pmd);
2929

30+
struct seq_file;
3031
void ptdump_walk_pgd_level(struct seq_file *m, struct mm_struct *mm);
3132
void ptdump_walk_pgd_level_debugfs(struct seq_file *m, struct mm_struct *mm,
3233
bool user);

arch/x86/include/asm/pgtable_types.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,6 @@ extern void native_pagetable_init(void);
513513
#define native_pagetable_init paging_init
514514
#endif
515515

516-
struct seq_file;
517-
extern void arch_report_meminfo(struct seq_file *m);
518-
519516
enum pg_level {
520517
PG_LEVEL_NONE,
521518
PG_LEVEL_4K,

arch/x86/mm/pat/set_memory.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/mm.h>
1010
#include <linux/interrupt.h>
1111
#include <linux/seq_file.h>
12+
#include <linux/proc_fs.h>
1213
#include <linux/debugfs.h>
1314
#include <linux/pfn.h>
1415
#include <linux/percpu.h>

fs/aio.c

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ static int aio_setup_ring(struct kioctx *ctx, unsigned int nr_events)
530530
for (i = 0; i < nr_pages; i++) {
531531
struct page *page;
532532
page = find_or_create_page(file->f_mapping,
533-
i, GFP_HIGHUSER | __GFP_ZERO);
533+
i, GFP_USER | __GFP_ZERO);
534534
if (!page)
535535
break;
536536
pr_debug("pid(%d) page[%d]->count=%d\n",
@@ -571,15 +571,14 @@ static int aio_setup_ring(struct kioctx *ctx, unsigned int nr_events)
571571
ctx->user_id = ctx->mmap_base;
572572
ctx->nr_events = nr_events; /* trusted copy */
573573

574-
ring = kmap_atomic(ctx->ring_pages[0]);
574+
ring = page_address(ctx->ring_pages[0]);
575575
ring->nr = nr_events; /* user copy */
576576
ring->id = ~0U;
577577
ring->head = ring->tail = 0;
578578
ring->magic = AIO_RING_MAGIC;
579579
ring->compat_features = AIO_RING_COMPAT_FEATURES;
580580
ring->incompat_features = AIO_RING_INCOMPAT_FEATURES;
581581
ring->header_length = sizeof(struct aio_ring);
582-
kunmap_atomic(ring);
583582
flush_dcache_page(ctx->ring_pages[0]);
584583

585584
return 0;
@@ -682,9 +681,8 @@ static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm)
682681
* we are protected from page migration
683682
* changes ring_pages by ->ring_lock.
684683
*/
685-
ring = kmap_atomic(ctx->ring_pages[0]);
684+
ring = page_address(ctx->ring_pages[0]);
686685
ring->id = ctx->id;
687-
kunmap_atomic(ring);
688686
return 0;
689687
}
690688

@@ -1025,9 +1023,8 @@ static void user_refill_reqs_available(struct kioctx *ctx)
10251023
* against ctx->completed_events below will make sure we do the
10261024
* safe/right thing.
10271025
*/
1028-
ring = kmap_atomic(ctx->ring_pages[0]);
1026+
ring = page_address(ctx->ring_pages[0]);
10291027
head = ring->head;
1030-
kunmap_atomic(ring);
10311028

10321029
refill_reqs_available(ctx, head, ctx->tail);
10331030
}
@@ -1133,12 +1130,11 @@ static void aio_complete(struct aio_kiocb *iocb)
11331130
if (++tail >= ctx->nr_events)
11341131
tail = 0;
11351132

1136-
ev_page = kmap_atomic(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]);
1133+
ev_page = page_address(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]);
11371134
event = ev_page + pos % AIO_EVENTS_PER_PAGE;
11381135

11391136
*event = iocb->ki_res;
11401137

1141-
kunmap_atomic(ev_page);
11421138
flush_dcache_page(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]);
11431139

11441140
pr_debug("%p[%u]: %p: %p %Lx %Lx %Lx\n", ctx, tail, iocb,
@@ -1152,10 +1148,9 @@ static void aio_complete(struct aio_kiocb *iocb)
11521148

11531149
ctx->tail = tail;
11541150

1155-
ring = kmap_atomic(ctx->ring_pages[0]);
1151+
ring = page_address(ctx->ring_pages[0]);
11561152
head = ring->head;
11571153
ring->tail = tail;
1158-
kunmap_atomic(ring);
11591154
flush_dcache_page(ctx->ring_pages[0]);
11601155

11611156
ctx->completed_events++;
@@ -1215,10 +1210,9 @@ static long aio_read_events_ring(struct kioctx *ctx,
12151210
mutex_lock(&ctx->ring_lock);
12161211

12171212
/* Access to ->ring_pages here is protected by ctx->ring_lock. */
1218-
ring = kmap_atomic(ctx->ring_pages[0]);
1213+
ring = page_address(ctx->ring_pages[0]);
12191214
head = ring->head;
12201215
tail = ring->tail;
1221-
kunmap_atomic(ring);
12221216

12231217
/*
12241218
* Ensure that once we've read the current tail pointer, that
@@ -1250,10 +1244,9 @@ static long aio_read_events_ring(struct kioctx *ctx,
12501244
avail = min(avail, nr - ret);
12511245
avail = min_t(long, avail, AIO_EVENTS_PER_PAGE - pos);
12521246

1253-
ev = kmap(page);
1247+
ev = page_address(page);
12541248
copy_ret = copy_to_user(event + ret, ev + pos,
12551249
sizeof(*ev) * avail);
1256-
kunmap(page);
12571250

12581251
if (unlikely(copy_ret)) {
12591252
ret = -EFAULT;
@@ -1265,9 +1258,8 @@ static long aio_read_events_ring(struct kioctx *ctx,
12651258
head %= ctx->nr_events;
12661259
}
12671260

1268-
ring = kmap_atomic(ctx->ring_pages[0]);
1261+
ring = page_address(ctx->ring_pages[0]);
12691262
ring->head = head;
1270-
kunmap_atomic(ring);
12711263
flush_dcache_page(ctx->ring_pages[0]);
12721264

12731265
pr_debug("%li h%u t%u\n", ret, head, tail);

fs/autofs/root.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ static int autofs_dir_symlink(struct mnt_idmap *idmap,
600600
p_ino = autofs_dentry_ino(dentry->d_parent);
601601
p_ino->count++;
602602

603-
dir->i_mtime = current_time(dir);
603+
dir->i_mtime = dir->i_ctime = current_time(dir);
604604

605605
return 0;
606606
}
@@ -633,7 +633,7 @@ static int autofs_dir_unlink(struct inode *dir, struct dentry *dentry)
633633
d_inode(dentry)->i_size = 0;
634634
clear_nlink(d_inode(dentry));
635635

636-
dir->i_mtime = current_time(dir);
636+
dir->i_mtime = dir->i_ctime = current_time(dir);
637637

638638
spin_lock(&sbi->lookup_lock);
639639
__autofs_add_expiring(dentry);
@@ -749,7 +749,7 @@ static int autofs_dir_mkdir(struct mnt_idmap *idmap,
749749
p_ino = autofs_dentry_ino(dentry->d_parent);
750750
p_ino->count++;
751751
inc_nlink(dir);
752-
dir->i_mtime = current_time(dir);
752+
dir->i_mtime = dir->i_ctime = current_time(dir);
753753

754754
return 0;
755755
}

fs/buffer.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ void buffer_check_dirty_writeback(struct folio *folio,
111111
bh = bh->b_this_page;
112112
} while (bh != head);
113113
}
114-
EXPORT_SYMBOL(buffer_check_dirty_writeback);
115114

116115
/*
117116
* Block until a buffer comes unlocked. This doesn't stop it

0 commit comments

Comments
 (0)