History

Merge tag 'for_v5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull quota, ext2, reiserfs updates from Jan Kara: - support for path (instead of device) based quotactl syscall (quotactl_path(2)) - ext2 conversion to kmap_local() - other minor cleanups & fixes * tag 'for_v5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: fs/reiserfs/journal.c: delete useless variables fs/ext2: Replace kmap() with kmap_local_page() ext2: Match up ext2_put_page() with ext2_dotdot() and ext2_find_entry() fs/ext2/: fix misspellings using codespell tool quota: report warning limits for realtime space quotas quota: wire up quotactl_path quota: Add mountpath based quota support

Linus Torvalds committed 5 years ago

Commit 767fcbc2 parents d2b6f8a a3cc75428 files · +168 −62Browse files

Unified · Split

28 files
  1. arch/alpha/kernel/syscalls/syscall.tbl +1 −0
  2. arch/arm/tools/syscall.tbl +1 −0
  3. arch/arm64/include/asm/unistd.h +1 −1
  4. arch/arm64/include/asm/unistd32.h +2 −0
  5. arch/ia64/kernel/syscalls/syscall.tbl +1 −0
  6. arch/m68k/kernel/syscalls/syscall.tbl +1 −0
  7. arch/microblaze/kernel/syscalls/syscall.tbl +1 −0
  8. arch/mips/kernel/syscalls/syscall_n32.tbl +1 −0
  9. arch/mips/kernel/syscalls/syscall_n64.tbl +1 −0
  10. arch/mips/kernel/syscalls/syscall_o32.tbl +1 −0
  11. arch/parisc/kernel/syscalls/syscall.tbl +1 −0
  12. arch/powerpc/kernel/syscalls/syscall.tbl +1 −0
  13. arch/s390/kernel/syscalls/syscall.tbl +1 −0
  14. arch/sh/kernel/syscalls/syscall.tbl +1 −0
  15. arch/sparc/kernel/syscalls/syscall.tbl +1 −0
  16. arch/x86/entry/syscalls/syscall_32.tbl +1 −0
  17. arch/x86/entry/syscalls/syscall_64.tbl +1 −0
  18. arch/xtensa/kernel/syscalls/syscall.tbl +1 −0
  19. fs/ext2/dir.c +60 −34
  20. fs/ext2/ext2.h +7 −5
  21. fs/ext2/namei.c +22 −12
  22. fs/ext2/super.c +1 −1
  23. fs/quota/quota.c +47 −3
  24. fs/reiserfs/journal.c +2 −4
  25. include/linux/syscalls.h +2 −0
  26. include/uapi/asm-generic/unistd.h +3 −1
  27. include/uapi/linux/dqblk_xfs.h +4 −1
  28. kernel/sys_ni.c +1 −0
arch/alpha/kernel/syscalls/syscall.tbl+1−0
@@ -482,3 +482,4 @@ · 481 unmodified lines
482550 common process_madvise sys_process_madvise482550 common process_madvise sys_process_madvise
483551 common epoll_pwait2 sys_epoll_pwait2483551 common epoll_pwait2 sys_epoll_pwait2
484552 common mount_setattr sys_mount_setattr484552 common mount_setattr sys_mount_setattr
485553 common quotactl_path sys_quotactl_path
arch/arm/tools/syscall.tbl+1−0
@@ -456,3 +456,4 @@ · 455 unmodified lines
456440 common process_madvise sys_process_madvise456440 common process_madvise sys_process_madvise
457441 common epoll_pwait2 sys_epoll_pwait2457441 common epoll_pwait2 sys_epoll_pwait2
458442 common mount_setattr sys_mount_setattr458442 common mount_setattr sys_mount_setattr
459443 common quotactl_path sys_quotactl_path
arch/arm64/include/asm/unistd.h+1−1
@@ -38,7 +38,7 @@ · 37 unmodified lines
38#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5)38#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5)
39#define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800)39#define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800)
40 40
41#define __NR_compat_syscalls 44341#define __NR_compat_syscalls 444
42#endif42#endif
43 43
44#define __ARCH_WANT_SYS_CLONE44#define __ARCH_WANT_SYS_CLONE
arch/arm64/include/asm/unistd32.h+2−0
@@ -893,6 +893,8 @@ __SYSCALL(__NR_process_madvise, sys_process_madvise) · 892 unmodified lines
893__SYSCALL(__NR_epoll_pwait2, compat_sys_epoll_pwait2)893__SYSCALL(__NR_epoll_pwait2, compat_sys_epoll_pwait2)
894#define __NR_mount_setattr 442894#define __NR_mount_setattr 442
895__SYSCALL(__NR_mount_setattr, sys_mount_setattr)895__SYSCALL(__NR_mount_setattr, sys_mount_setattr)
896#define __NR_quotactl_path 443
897__SYSCALL(__NR_quotactl_path, sys_quotactl_path)
896 898
897/*899/*
898 * Please add new compat syscalls above this comment and update900 * Please add new compat syscalls above this comment and update
arch/ia64/kernel/syscalls/syscall.tbl+1−0
@@ -363,3 +363,4 @@ · 362 unmodified lines
363440 common process_madvise sys_process_madvise363440 common process_madvise sys_process_madvise
364441 common epoll_pwait2 sys_epoll_pwait2364441 common epoll_pwait2 sys_epoll_pwait2
365442 common mount_setattr sys_mount_setattr365442 common mount_setattr sys_mount_setattr
366443 common quotactl_path sys_quotactl_path
arch/m68k/kernel/syscalls/syscall.tbl+1−0
@@ -442,3 +442,4 @@ · 441 unmodified lines
442440 common process_madvise sys_process_madvise442440 common process_madvise sys_process_madvise
443441 common epoll_pwait2 sys_epoll_pwait2443441 common epoll_pwait2 sys_epoll_pwait2
444442 common mount_setattr sys_mount_setattr444442 common mount_setattr sys_mount_setattr
445443 common quotactl_path sys_quotactl_path
arch/microblaze/kernel/syscalls/syscall.tbl+1−0
@@ -448,3 +448,4 @@ · 447 unmodified lines
448440 common process_madvise sys_process_madvise448440 common process_madvise sys_process_madvise
449441 common epoll_pwait2 sys_epoll_pwait2449441 common epoll_pwait2 sys_epoll_pwait2
450442 common mount_setattr sys_mount_setattr450442 common mount_setattr sys_mount_setattr
451443 common quotactl_path sys_quotactl_path
arch/mips/kernel/syscalls/syscall_n32.tbl+1−0
@@ -381,3 +381,4 @@ · 380 unmodified lines
381440 n32 process_madvise sys_process_madvise381440 n32 process_madvise sys_process_madvise
382441 n32 epoll_pwait2 compat_sys_epoll_pwait2382441 n32 epoll_pwait2 compat_sys_epoll_pwait2
383442 n32 mount_setattr sys_mount_setattr383442 n32 mount_setattr sys_mount_setattr
384443 n32 quotactl_path sys_quotactl_path
arch/mips/kernel/syscalls/syscall_n64.tbl+1−0
@@ -357,3 +357,4 @@ · 356 unmodified lines
357440 n64 process_madvise sys_process_madvise357440 n64 process_madvise sys_process_madvise
358441 n64 epoll_pwait2 sys_epoll_pwait2358441 n64 epoll_pwait2 sys_epoll_pwait2
359442 n64 mount_setattr sys_mount_setattr359442 n64 mount_setattr sys_mount_setattr
360443 n64 quotactl_path sys_quotactl_path
arch/mips/kernel/syscalls/syscall_o32.tbl+1−0
@@ -430,3 +430,4 @@ · 429 unmodified lines
430440 o32 process_madvise sys_process_madvise430440 o32 process_madvise sys_process_madvise
431441 o32 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2431441 o32 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
432442 o32 mount_setattr sys_mount_setattr432442 o32 mount_setattr sys_mount_setattr
433443 o32 quotactl_path sys_quotactl_path
arch/parisc/kernel/syscalls/syscall.tbl+1−0
@@ -440,3 +440,4 @@ · 439 unmodified lines
440440 common process_madvise sys_process_madvise440440 common process_madvise sys_process_madvise
441441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2441441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
442442 common mount_setattr sys_mount_setattr442442 common mount_setattr sys_mount_setattr
443443 common quotactl_path sys_quotactl_path
arch/powerpc/kernel/syscalls/syscall.tbl+1−0
@@ -522,3 +522,4 @@ · 521 unmodified lines
522440 common process_madvise sys_process_madvise522440 common process_madvise sys_process_madvise
523441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2523441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
524442 common mount_setattr sys_mount_setattr524442 common mount_setattr sys_mount_setattr
525443 common quotactl_path sys_quotactl_path
arch/s390/kernel/syscalls/syscall.tbl+1−0
@@ -445,3 +445,4 @@ · 444 unmodified lines
445440 common process_madvise sys_process_madvise sys_process_madvise445440 common process_madvise sys_process_madvise sys_process_madvise
446441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2446441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
447442 common mount_setattr sys_mount_setattr sys_mount_setattr447442 common mount_setattr sys_mount_setattr sys_mount_setattr
448443 common quotactl_path sys_quotactl_path sys_quotactl_path
arch/sh/kernel/syscalls/syscall.tbl+1−0
@@ -445,3 +445,4 @@ · 444 unmodified lines
445440 common process_madvise sys_process_madvise445440 common process_madvise sys_process_madvise
446441 common epoll_pwait2 sys_epoll_pwait2446441 common epoll_pwait2 sys_epoll_pwait2
447442 common mount_setattr sys_mount_setattr447442 common mount_setattr sys_mount_setattr
448443 common quotactl_path sys_quotactl_path
arch/sparc/kernel/syscalls/syscall.tbl+1−0
@@ -488,3 +488,4 @@ · 487 unmodified lines
488440 common process_madvise sys_process_madvise488440 common process_madvise sys_process_madvise
489441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2489441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
490442 common mount_setattr sys_mount_setattr490442 common mount_setattr sys_mount_setattr
491443 common quotactl_path sys_quotactl_path
arch/x86/entry/syscalls/syscall_32.tbl+1−0
@@ -447,3 +447,4 @@ · 446 unmodified lines
447440 i386 process_madvise sys_process_madvise447440 i386 process_madvise sys_process_madvise
448441 i386 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2448441 i386 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
449442 i386 mount_setattr sys_mount_setattr449442 i386 mount_setattr sys_mount_setattr
450443 i386 quotactl_path sys_quotactl_path
arch/x86/entry/syscalls/syscall_64.tbl+1−0
@@ -364,6 +364,7 @@ · 363 unmodified lines
364440 common process_madvise sys_process_madvise364440 common process_madvise sys_process_madvise
365441 common epoll_pwait2 sys_epoll_pwait2365441 common epoll_pwait2 sys_epoll_pwait2
366442 common mount_setattr sys_mount_setattr366442 common mount_setattr sys_mount_setattr
367443 common quotactl_path sys_quotactl_path
367 368
368#369#
369# Due to a historical design error, certain syscalls are numbered differently370# Due to a historical design error, certain syscalls are numbered differently
arch/xtensa/kernel/syscalls/syscall.tbl+1−0
@@ -413,3 +413,4 @@ · 412 unmodified lines
413440 common process_madvise sys_process_madvise413440 common process_madvise sys_process_madvise
414441 common epoll_pwait2 sys_epoll_pwait2414441 common epoll_pwait2 sys_epoll_pwait2
415442 common mount_setattr sys_mount_setattr415442 common mount_setattr sys_mount_setattr
416443 common quotactl_path sys_quotactl_path
fs/ext2/dir.c+60−34
@@ -190,13 +190,20 @@ fail: · 189 unmodified lines
190 return false;190 return false;
191}191}
192 192
193/*
194 * Calls to ext2_get_page()/ext2_put_page() must be nested according to the
195 * rules documented in kmap_local_page()/kunmap_local().
196 *
197 * NOTE: ext2_find_entry() and ext2_dotdot() act as a call to ext2_get_page()
198 * and should be treated as a call to ext2_get_page() for nesting purposes.
199 */
193static struct page * ext2_get_page(struct inode *dir, unsigned long n,200static struct page * ext2_get_page(struct inode *dir, unsigned long n,
194 int quiet)201 int quiet, void **page_addr)
195{202{
196 struct address_space *mapping = dir->i_mapping;203 struct address_space *mapping = dir->i_mapping;
197 struct page *page = read_mapping_page(mapping, n, NULL);204 struct page *page = read_mapping_page(mapping, n, NULL);
198 if (!IS_ERR(page)) {205 if (!IS_ERR(page)) {
199 kmap(page);206 *page_addr = kmap_local_page(page);
200 if (unlikely(!PageChecked(page))) {207 if (unlikely(!PageChecked(page))) {
201 if (PageError(page) || !ext2_check_page(page, quiet))208 if (PageError(page) || !ext2_check_page(page, quiet))
202 goto fail;209 goto fail;
@@ -205,7 +212,7 @@ static struct page * ext2_get_page(struct inode *dir, unsigned long n, · 2 unmodified lines
205 return page;212 return page;
206 213
207fail:214fail:
208 ext2_put_page(page);215 ext2_put_page(page, *page_addr);
209 return ERR_PTR(-EIO);216 return ERR_PTR(-EIO);
210}217}
211 218
@@ -276,7 +283,7 @@ ext2_readdir(struct file *file, struct dir_context *ctx) · 64 unmodified lines
276 for ( ; n < npages; n++, offset = 0) {283 for ( ; n < npages; n++, offset = 0) {
277 char *kaddr, *limit;284 char *kaddr, *limit;
278 ext2_dirent *de;285 ext2_dirent *de;
279 struct page *page = ext2_get_page(inode, n, 0);286 struct page *page = ext2_get_page(inode, n, 0, (void **)&kaddr);
280 287
281 if (IS_ERR(page)) {288 if (IS_ERR(page)) {
282 ext2_error(sb, __func__,289 ext2_error(sb, __func__,
@@ -285,7 +292,6 @@ ext2_readdir(struct file *file, struct dir_context *ctx) · 2 unmodified lines
285 ctx->pos += PAGE_SIZE - offset;292 ctx->pos += PAGE_SIZE - offset;
286 return PTR_ERR(page);293 return PTR_ERR(page);
287 }294 }
288 kaddr = page_address(page);
289 if (unlikely(need_revalidate)) {295 if (unlikely(need_revalidate)) {
290 if (offset) {296 if (offset) {
291 offset = ext2_validate_entry(kaddr, offset, chunk_mask);297 offset = ext2_validate_entry(kaddr, offset, chunk_mask);
@@ -300,7 +306,7 @@ ext2_readdir(struct file *file, struct dir_context *ctx) · 8 unmodified lines
300 if (de->rec_len == 0) {306 if (de->rec_len == 0) {
301 ext2_error(sb, __func__,307 ext2_error(sb, __func__,
302 "zero-length directory entry");308 "zero-length directory entry");
303 ext2_put_page(page);309 ext2_put_page(page, kaddr);
304 return -EIO;310 return -EIO;
305 }311 }
306 if (de->inode) {312 if (de->inode) {
@@ -312,13 +318,13 @@ ext2_readdir(struct file *file, struct dir_context *ctx) · 5 unmodified lines
312 if (!dir_emit(ctx, de->name, de->name_len,318 if (!dir_emit(ctx, de->name, de->name_len,
313 le32_to_cpu(de->inode),319 le32_to_cpu(de->inode),
314 d_type)) {320 d_type)) {
315 ext2_put_page(page);321 ext2_put_page(page, kaddr);
316 return 0;322 return 0;
317 }323 }
318 }324 }
319 ctx->pos += ext2_rec_len_from_disk(de->rec_len);325 ctx->pos += ext2_rec_len_from_disk(de->rec_len);
320 }326 }
321 ext2_put_page(page);327 ext2_put_page(page, kaddr);
322 }328 }
323 return 0;329 return 0;
324}330}
@@ -332,9 +338,16 @@ ext2_readdir(struct file *file, struct dir_context *ctx) · 7 unmodified lines
332 * Entry is guaranteed to be valid.338 * Entry is guaranteed to be valid.
333 *339 *
334 * On Success ext2_put_page() should be called on *res_page.340 * On Success ext2_put_page() should be called on *res_page.
341 *
342 * NOTE: Calls to ext2_get_page()/ext2_put_page() must be nested according to
343 * the rules documented in kmap_local_page()/kunmap_local().
344 *
345 * ext2_find_entry() and ext2_dotdot() act as a call to ext2_get_page() and
346 * should be treated as a call to ext2_get_page() for nesting purposes.
335 */347 */
336struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir,348struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir,
337 const struct qstr *child, struct page **res_page)349 const struct qstr *child, struct page **res_page,
350 void **res_page_addr)
338{351{
339 const char *name = child->name;352 const char *name = child->name;
340 int namelen = child->len;353 int namelen = child->len;
@@ -344,12 +357,14 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir, · 3 unmodified lines
344 struct page *page = NULL;357 struct page *page = NULL;
345 struct ext2_inode_info *ei = EXT2_I(dir);358 struct ext2_inode_info *ei = EXT2_I(dir);
346 ext2_dirent * de;359 ext2_dirent * de;
360 void *page_addr;
347 361
348 if (npages == 0)362 if (npages == 0)
349 goto out;363 goto out;
350 364
351 /* OFFSET_CACHE */365 /* OFFSET_CACHE */
352 *res_page = NULL;366 *res_page = NULL;
367 *res_page_addr = NULL;
353 368
354 start = ei->i_dir_start_lookup;369 start = ei->i_dir_start_lookup;
355 if (start >= npages)370 if (start >= npages)
@@ -357,25 +372,25 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir, · 1 unmodified line
357 n = start;372 n = start;
358 do {373 do {
359 char *kaddr;374 char *kaddr;
360 page = ext2_get_page(dir, n, 0);375 page = ext2_get_page(dir, n, 0, &page_addr);
361 if (IS_ERR(page))376 if (IS_ERR(page))
362 return ERR_CAST(page);377 return ERR_CAST(page);
363 378
364 kaddr = page_address(page);379 kaddr = page_addr;
365 de = (ext2_dirent *) kaddr;380 de = (ext2_dirent *) kaddr;
366 kaddr += ext2_last_byte(dir, n) - reclen;381 kaddr += ext2_last_byte(dir, n) - reclen;
367 while ((char *) de <= kaddr) {382 while ((char *) de <= kaddr) {
368 if (de->rec_len == 0) {383 if (de->rec_len == 0) {
369 ext2_error(dir->i_sb, __func__,384 ext2_error(dir->i_sb, __func__,
370 "zero-length directory entry");385 "zero-length directory entry");
371 ext2_put_page(page);386 ext2_put_page(page, page_addr);
372 goto out;387 goto out;
373 }388 }
374 if (ext2_match(namelen, name, de))389 if (ext2_match(namelen, name, de))
375 goto found;390 goto found;
376 de = ext2_next_entry(de);391 de = ext2_next_entry(de);
377 }392 }
378 ext2_put_page(page);393 ext2_put_page(page, page_addr);
379 394
380 if (++n >= npages)395 if (++n >= npages)
381 n = 0;396 n = 0;
@@ -393,6 +408,7 @@ out: · 11 unmodified lines
393 408
394found:409found:
395 *res_page = page;410 *res_page = page;
411 *res_page_addr = page_addr;
396 ei->i_dir_start_lookup = n;412 ei->i_dir_start_lookup = n;
397 return de;413 return de;
398}414}
@@ -402,15 +418,24 @@ found: · 3 unmodified lines
402 * (as a parameter - p).418 * (as a parameter - p).
403 *419 *
404 * On Success ext2_put_page() should be called on *p.420 * On Success ext2_put_page() should be called on *p.
421 *
422 * NOTE: Calls to ext2_get_page()/ext2_put_page() must be nested according to
423 * the rules documented in kmap_local_page()/kunmap_local().
424 *
425 * ext2_find_entry() and ext2_dotdot() act as a call to ext2_get_page() and
426 * should be treated as a call to ext2_get_page() for nesting purposes.
405 */427 */
406struct ext2_dir_entry_2 * ext2_dotdot (struct inode *dir, struct page **p)428struct ext2_dir_entry_2 *ext2_dotdot(struct inode *dir, struct page **p,
429 void **pa)
407{430{
408 struct page *page = ext2_get_page(dir, 0, 0);431 void *page_addr;
432 struct page *page = ext2_get_page(dir, 0, 0, &page_addr);
409 ext2_dirent *de = NULL;433 ext2_dirent *de = NULL;
410 434
411 if (!IS_ERR(page)) {435 if (!IS_ERR(page)) {
412 de = ext2_next_entry((ext2_dirent *) page_address(page));436 de = ext2_next_entry((ext2_dirent *) page_addr);
413 *p = page;437 *p = page;
438 *pa = page_addr;
414 }439 }
415 return de;440 return de;
416}441}
@@ -419,13 +444,14 @@ int ext2_inode_by_name(struct inode *dir, const struct qstr *child, ino_t *ino) · 2 unmodified lines
419{444{
420 struct ext2_dir_entry_2 *de;445 struct ext2_dir_entry_2 *de;
421 struct page *page;446 struct page *page;
447 void *page_addr;
422 448
423 de = ext2_find_entry(dir, child, &page);449 de = ext2_find_entry(dir, child, &page, &page_addr);
424 if (IS_ERR(de))450 if (IS_ERR(de))
425 return PTR_ERR(de);451 return PTR_ERR(de);
426 452
427 *ino = le32_to_cpu(de->inode);453 *ino = le32_to_cpu(de->inode);
428 ext2_put_page(page);454 ext2_put_page(page, page_addr);
429 return 0;455 return 0;
430}456}
431 457
@@ -434,12 +460,12 @@ static int ext2_prepare_chunk(struct page *page, loff_t pos, unsigned len) · 2 unmodified lines
434 return __block_write_begin(page, pos, len, ext2_get_block);460 return __block_write_begin(page, pos, len, ext2_get_block);
435}461}
436 462
437/* Releases the page */
438void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,463void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
439 struct page *page, struct inode *inode, int update_times)464 struct page *page, void *page_addr, struct inode *inode,
465 int update_times)
440{466{
441 loff_t pos = page_offset(page) +467 loff_t pos = page_offset(page) +
442 (char *) de - (char *) page_address(page);468 (char *) de - (char *) page_addr;
443 unsigned len = ext2_rec_len_from_disk(de->rec_len);469 unsigned len = ext2_rec_len_from_disk(de->rec_len);
444 int err;470 int err;
445 471
@@ -449,7 +475,6 @@ void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de, · 3 unmodified lines
449 de->inode = cpu_to_le32(inode->i_ino);475 de->inode = cpu_to_le32(inode->i_ino);
450 ext2_set_de_type(de, inode);476 ext2_set_de_type(de, inode);
451 err = ext2_commit_chunk(page, pos, len);477 err = ext2_commit_chunk(page, pos, len);
452 ext2_put_page(page);
453 if (update_times)478 if (update_times)
454 dir->i_mtime = dir->i_ctime = current_time(dir);479 dir->i_mtime = dir->i_ctime = current_time(dir);
455 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;480 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
@@ -468,10 +493,10 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode) · 12 unmodified lines
468 unsigned reclen = EXT2_DIR_REC_LEN(namelen);493 unsigned reclen = EXT2_DIR_REC_LEN(namelen);
469 unsigned short rec_len, name_len;494 unsigned short rec_len, name_len;
470 struct page *page = NULL;495 struct page *page = NULL;
496 void *page_addr = NULL;
471 ext2_dirent * de;497 ext2_dirent * de;
472 unsigned long npages = dir_pages(dir);498 unsigned long npages = dir_pages(dir);
473 unsigned long n;499 unsigned long n;
474 char *kaddr;
475 loff_t pos;500 loff_t pos;
476 int err;501 int err;
477 502
@@ -481,14 +506,15 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode) · 3 unmodified lines
481 * to protect that region.506 * to protect that region.
482 */507 */
483 for (n = 0; n <= npages; n++) {508 for (n = 0; n <= npages; n++) {
509 char *kaddr;
484 char *dir_end;510 char *dir_end;
485 511
486 page = ext2_get_page(dir, n, 0);512 page = ext2_get_page(dir, n, 0, &page_addr);
487 err = PTR_ERR(page);513 err = PTR_ERR(page);
488 if (IS_ERR(page))514 if (IS_ERR(page))
489 goto out;515 goto out;
490 lock_page(page);516 lock_page(page);
491 kaddr = page_address(page);517 kaddr = page_addr;
492 dir_end = kaddr + ext2_last_byte(dir, n);518 dir_end = kaddr + ext2_last_byte(dir, n);
493 de = (ext2_dirent *)kaddr;519 de = (ext2_dirent *)kaddr;
494 kaddr += PAGE_SIZE - reclen;520 kaddr += PAGE_SIZE - reclen;
@@ -519,14 +545,14 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode) · 24 unmodified lines
519 de = (ext2_dirent *) ((char *) de + rec_len);545 de = (ext2_dirent *) ((char *) de + rec_len);
520 }546 }
521 unlock_page(page);547 unlock_page(page);
522 ext2_put_page(page);548 ext2_put_page(page, page_addr);
523 }549 }
524 BUG();550 BUG();
525 return -EINVAL;551 return -EINVAL;
526 552
527got_it:553got_it:
528 pos = page_offset(page) +554 pos = page_offset(page) +
529 (char*)de - (char*)page_address(page);555 (char *)de - (char *)page_addr;
530 err = ext2_prepare_chunk(page, pos, rec_len);556 err = ext2_prepare_chunk(page, pos, rec_len);
531 if (err)557 if (err)
532 goto out_unlock;558 goto out_unlock;
@@ -546,7 +572,7 @@ got_it: · 13 unmodified lines
546 mark_inode_dirty(dir);572 mark_inode_dirty(dir);
547 /* OFFSET_CACHE */573 /* OFFSET_CACHE */
548out_put:574out_put:
549 ext2_put_page(page);575 ext2_put_page(page, page_addr);
550out:576out:
551 return err;577 return err;
552out_unlock:578out_unlock:
@@ -556,7 +582,7 @@ out_unlock: · 3 unmodified lines
556 582
557/*583/*
558 * ext2_delete_entry deletes a directory entry by merging it with the584 * ext2_delete_entry deletes a directory entry by merging it with the
559 * previous entry. Page is up-to-date. Releases the page.585 * previous entry. Page is up-to-date.
560 */586 */
561int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )587int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )
562{588{
@@ -594,7 +620,6 @@ int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page ) · 31 unmodified lines
594 EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL;620 EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL;
595 mark_inode_dirty(inode);621 mark_inode_dirty(inode);
596out:622out:
597 ext2_put_page(page);
598 return err;623 return err;
599}624}
600 625
@@ -644,6 +669,7 @@ fail: · 43 unmodified lines
644 */669 */
645int ext2_empty_dir (struct inode * inode)670int ext2_empty_dir (struct inode * inode)
646{671{
672 void *page_addr = NULL;
647 struct page *page = NULL;673 struct page *page = NULL;
648 unsigned long i, npages = dir_pages(inode);674 unsigned long i, npages = dir_pages(inode);
649 int dir_has_error = 0;675 int dir_has_error = 0;
@@ -651,14 +677,14 @@ int ext2_empty_dir (struct inode * inode) · 1 unmodified line
651 for (i = 0; i < npages; i++) {677 for (i = 0; i < npages; i++) {
652 char *kaddr;678 char *kaddr;
653 ext2_dirent * de;679 ext2_dirent * de;
654 page = ext2_get_page(inode, i, dir_has_error);680 page = ext2_get_page(inode, i, dir_has_error, &page_addr);
655 681
656 if (IS_ERR(page)) {682 if (IS_ERR(page)) {
657 dir_has_error = 1;683 dir_has_error = 1;
658 continue;684 continue;
659 }685 }
660 686
661 kaddr = page_address(page);687 kaddr = page_addr;
662 de = (ext2_dirent *)kaddr;688 de = (ext2_dirent *)kaddr;
663 kaddr += ext2_last_byte(inode, i) - EXT2_DIR_REC_LEN(1);689 kaddr += ext2_last_byte(inode, i) - EXT2_DIR_REC_LEN(1);
664 690
@@ -684,12 +710,12 @@ int ext2_empty_dir (struct inode * inode) · 19 unmodified lines
684 }710 }
685 de = ext2_next_entry(de);711 de = ext2_next_entry(de);
686 }712 }
687 ext2_put_page(page);713 ext2_put_page(page, page_addr);
688 }714 }
689 return 1;715 return 1;
690 716
691not_empty:717not_empty:
692 ext2_put_page(page);718 ext2_put_page(page, page_addr);
693 return 0;719 return 0;
694}720}
695 721
fs/ext2/ext2.h+7−5
@@ -738,14 +738,16 @@ extern int ext2_add_link (struct dentry *, struct inode *); · 737 unmodified lines
738extern int ext2_inode_by_name(struct inode *dir,738extern int ext2_inode_by_name(struct inode *dir,
739 const struct qstr *child, ino_t *ino);739 const struct qstr *child, ino_t *ino);
740extern int ext2_make_empty(struct inode *, struct inode *);740extern int ext2_make_empty(struct inode *, struct inode *);
741extern struct ext2_dir_entry_2 * ext2_find_entry (struct inode *,const struct qstr *, struct page **);741extern struct ext2_dir_entry_2 *ext2_find_entry(struct inode *, const struct qstr *,
742 struct page **, void **res_page_addr);
742extern int ext2_delete_entry (struct ext2_dir_entry_2 *, struct page *);743extern int ext2_delete_entry (struct ext2_dir_entry_2 *, struct page *);
743extern int ext2_empty_dir (struct inode *);744extern int ext2_empty_dir (struct inode *);
744extern struct ext2_dir_entry_2 * ext2_dotdot (struct inode *, struct page **);745extern struct ext2_dir_entry_2 *ext2_dotdot(struct inode *dir, struct page **p, void **pa);
745extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, struct inode *, int);746extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, void *,
746static inline void ext2_put_page(struct page *page)747 struct inode *, int);
748static inline void ext2_put_page(struct page *page, void *page_addr)
747{749{
748 kunmap(page);750 kunmap_local(page_addr);
749 put_page(page);751 put_page(page);
750}752}
751 753
fs/ext2/namei.c+22−12
@@ -281,19 +281,21 @@ static int ext2_unlink(struct inode * dir, struct dentry *dentry) · 280 unmodified lines
281 struct inode * inode = d_inode(dentry);281 struct inode * inode = d_inode(dentry);
282 struct ext2_dir_entry_2 * de;282 struct ext2_dir_entry_2 * de;
283 struct page * page;283 struct page * page;
284 void *page_addr;
284 int err;285 int err;
285 286
286 err = dquot_initialize(dir);287 err = dquot_initialize(dir);
287 if (err)288 if (err)
288 goto out;289 goto out;
289 290
290 de = ext2_find_entry(dir, &dentry->d_name, &page);291 de = ext2_find_entry(dir, &dentry->d_name, &page, &page_addr);
291 if (IS_ERR(de)) {292 if (IS_ERR(de)) {
292 err = PTR_ERR(de);293 err = PTR_ERR(de);
293 goto out;294 goto out;
294 }295 }
295 296
296 err = ext2_delete_entry (de, page);297 err = ext2_delete_entry (de, page);
298 ext2_put_page(page, page_addr);
297 if (err)299 if (err)
298 goto out;300 goto out;
299 301
@@ -328,8 +330,10 @@ static int ext2_rename (struct user_namespace * mnt_userns, · 28 unmodified lines
328 struct inode * old_inode = d_inode(old_dentry);330 struct inode * old_inode = d_inode(old_dentry);
329 struct inode * new_inode = d_inode(new_dentry);331 struct inode * new_inode = d_inode(new_dentry);
330 struct page * dir_page = NULL;332 struct page * dir_page = NULL;
333 void *dir_page_addr;
331 struct ext2_dir_entry_2 * dir_de = NULL;334 struct ext2_dir_entry_2 * dir_de = NULL;
332 struct page * old_page;335 struct page * old_page;
336 void *old_page_addr;
333 struct ext2_dir_entry_2 * old_de;337 struct ext2_dir_entry_2 * old_de;
334 int err;338 int err;
335 339
@@ -344,7 +348,8 @@ static int ext2_rename (struct user_namespace * mnt_userns, · 8 unmodified lines
344 if (err)348 if (err)
345 goto out;349 goto out;
346 350
347 old_de = ext2_find_entry(old_dir, &old_dentry->d_name, &old_page);351 old_de = ext2_find_entry(old_dir, &old_dentry->d_name, &old_page,
352 &old_page_addr);
348 if (IS_ERR(old_de)) {353 if (IS_ERR(old_de)) {
349 err = PTR_ERR(old_de);354 err = PTR_ERR(old_de);
350 goto out;355 goto out;
@@ -352,12 +357,13 @@ static int ext2_rename (struct user_namespace * mnt_userns, · 1 unmodified line
352 357
353 if (S_ISDIR(old_inode->i_mode)) {358 if (S_ISDIR(old_inode->i_mode)) {
354 err = -EIO;359 err = -EIO;
355 dir_de = ext2_dotdot(old_inode, &dir_page);360 dir_de = ext2_dotdot(old_inode, &dir_page, &dir_page_addr);
356 if (!dir_de)361 if (!dir_de)
357 goto out_old;362 goto out_old;
358 }363 }
359 364
360 if (new_inode) {365 if (new_inode) {
366 void *page_addr;
361 struct page *new_page;367 struct page *new_page;
362 struct ext2_dir_entry_2 *new_de;368 struct ext2_dir_entry_2 *new_de;
363 369
@@ -365,12 +371,14 @@ static int ext2_rename (struct user_namespace * mnt_userns, · 1 unmodified line
365 if (dir_de && !ext2_empty_dir (new_inode))371 if (dir_de && !ext2_empty_dir (new_inode))
366 goto out_dir;372 goto out_dir;
367 373
368 new_de = ext2_find_entry(new_dir, &new_dentry->d_name, &new_page);374 new_de = ext2_find_entry(new_dir, &new_dentry->d_name,
375 &new_page, &page_addr);
369 if (IS_ERR(new_de)) {376 if (IS_ERR(new_de)) {
370 err = PTR_ERR(new_de);377 err = PTR_ERR(new_de);
371 goto out_dir;378 goto out_dir;
372 }379 }
373 ext2_set_link(new_dir, new_de, new_page, old_inode, 1);380 ext2_set_link(new_dir, new_de, new_page, page_addr, old_inode, 1);
381 ext2_put_page(new_page, page_addr);
374 new_inode->i_ctime = current_time(new_inode);382 new_inode->i_ctime = current_time(new_inode);
375 if (dir_de)383 if (dir_de)
376 drop_nlink(new_inode);384 drop_nlink(new_inode);
@@ -390,23 +398,25 @@ static int ext2_rename (struct user_namespace * mnt_userns, · 13 unmodified lines
390 old_inode->i_ctime = current_time(old_inode);398 old_inode->i_ctime = current_time(old_inode);
391 mark_inode_dirty(old_inode);399 mark_inode_dirty(old_inode);
392 400
393 ext2_delete_entry (old_de, old_page);401 ext2_delete_entry(old_de, old_page);
394 402
395 if (dir_de) {403 if (dir_de) {
396 if (old_dir != new_dir)404 if (old_dir != new_dir)
397 ext2_set_link(old_inode, dir_de, dir_page, new_dir, 0);405 ext2_set_link(old_inode, dir_de, dir_page,
398 else406 dir_page_addr, new_dir, 0);
399 ext2_put_page(dir_page);407
408 ext2_put_page(dir_page, dir_page_addr);
400 inode_dec_link_count(old_dir);409 inode_dec_link_count(old_dir);
401 }410 }
402 return 0;
403 411
412 ext2_put_page(old_page, old_page_addr);
413 return 0;
404 414
405out_dir:415out_dir:
406 if (dir_de)416 if (dir_de)
407 ext2_put_page(dir_page);417 ext2_put_page(dir_page, dir_page_addr);
408out_old:418out_old:
409 ext2_put_page(old_page);419 ext2_put_page(old_page, old_page_addr);
410out:420out:
411 return err;421 return err;
412}422}
fs/ext2/super.c+1−1
@@ -1104,7 +1104,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) · 1103 unmodified lines
1104 get_random_bytes(&sbi->s_next_generation, sizeof(u32));1104 get_random_bytes(&sbi->s_next_generation, sizeof(u32));
1105 spin_lock_init(&sbi->s_next_gen_lock);1105 spin_lock_init(&sbi->s_next_gen_lock);
1106 1106
1107 /* per fileystem reservation list head & lock */1107 /* per filesystem reservation list head & lock */
1108 spin_lock_init(&sbi->s_rsv_window_lock);1108 spin_lock_init(&sbi->s_rsv_window_lock);
1109 sbi->s_rsv_window_root = RB_ROOT;1109 sbi->s_rsv_window_root = RB_ROOT;
1110 /*1110 /*
fs/quota/quota.c+47−3
@@ -17,6 +17,7 @@ · 16 unmodified lines
17#include <linux/capability.h>17#include <linux/capability.h>
18#include <linux/quotaops.h>18#include <linux/quotaops.h>
19#include <linux/types.h>19#include <linux/types.h>
20#include <linux/mount.h>
20#include <linux/writeback.h>21#include <linux/writeback.h>
21#include <linux/nospec.h>22#include <linux/nospec.h>
22#include "compat.h"23#include "compat.h"
@@ -471,6 +472,7 @@ static int quota_getstatev(struct super_block *sb, int type, · 448 unmodified lines
471 fqs->qs_rtbtimelimit = state.s_state[type].rt_spc_timelimit;472 fqs->qs_rtbtimelimit = state.s_state[type].rt_spc_timelimit;
472 fqs->qs_bwarnlimit = state.s_state[type].spc_warnlimit;473 fqs->qs_bwarnlimit = state.s_state[type].spc_warnlimit;
473 fqs->qs_iwarnlimit = state.s_state[type].ino_warnlimit;474 fqs->qs_iwarnlimit = state.s_state[type].ino_warnlimit;
475 fqs->qs_rtbwarnlimit = state.s_state[type].rt_spc_warnlimit;
474 476
475 /* Inodes may be allocated even if inactive; copy out if present */477 /* Inodes may be allocated even if inactive; copy out if present */
476 if (state.s_state[USRQUOTA].ino) {478 if (state.s_state[USRQUOTA].ino) {
@@ -827,8 +829,6 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, · 350 unmodified lines
827 }829 }
828}830}
829 831
830#ifdef CONFIG_BLOCK
831
832/* Return 1 if 'cmd' will block on frozen filesystem */832/* Return 1 if 'cmd' will block on frozen filesystem */
833static int quotactl_cmd_write(int cmd)833static int quotactl_cmd_write(int cmd)
834{834{
@@ -850,7 +850,6 @@ static int quotactl_cmd_write(int cmd) · 15 unmodified lines
850 }850 }
851 return 1;851 return 1;
852}852}
853#endif /* CONFIG_BLOCK */
854 853
855/* Return true if quotactl command is manipulating quota on/off state */854/* Return true if quotactl command is manipulating quota on/off state */
856static bool quotactl_cmd_onoff(int cmd)855static bool quotactl_cmd_onoff(int cmd)
@@ -968,3 +967,48 @@ out: · 111 unmodified lines
968 path_put(pathp);967 path_put(pathp);
969 return ret;968 return ret;
970}969}
970
971SYSCALL_DEFINE4(quotactl_path, unsigned int, cmd, const char __user *,
972 mountpoint, qid_t, id, void __user *, addr)
973{
974 struct super_block *sb;
975 struct path mountpath;
976 unsigned int cmds = cmd >> SUBCMDSHIFT;
977 unsigned int type = cmd & SUBCMDMASK;
978 int ret;
979
980 if (type >= MAXQUOTAS)
981 return -EINVAL;
982
983 ret = user_path_at(AT_FDCWD, mountpoint,
984 LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT, &mountpath);
985 if (ret)
986 return ret;
987
988 sb = mountpath.mnt->mnt_sb;
989
990 if (quotactl_cmd_write(cmds)) {
991 ret = mnt_want_write(mountpath.mnt);
992 if (ret)
993 goto out;
994 }
995
996 if (quotactl_cmd_onoff(cmds))
997 down_write(&sb->s_umount);
998 else
999 down_read(&sb->s_umount);
1000
1001 ret = do_quotactl(sb, type, cmds, id, addr, ERR_PTR(-EINVAL));
1002
1003 if (quotactl_cmd_onoff(cmds))
1004 up_write(&sb->s_umount);
1005 else
1006 up_read(&sb->s_umount);
1007
1008 if (quotactl_cmd_write(cmds))
1009 mnt_drop_write(mountpath.mnt);
1010out:
1011 path_put(&mountpath);
1012
1013 return ret;
1014}
fs/reiserfs/journal.c+2−4
@@ -461,7 +461,6 @@ int reiserfs_in_journal(struct super_block *sb, · 460 unmodified lines
461 b_blocknr_t * next_zero_bit)461 b_blocknr_t * next_zero_bit)
462{462{
463 struct reiserfs_journal *journal = SB_JOURNAL(sb);463 struct reiserfs_journal *journal = SB_JOURNAL(sb);
464 struct reiserfs_journal_cnode *cn;
465 struct reiserfs_list_bitmap *jb;464 struct reiserfs_list_bitmap *jb;
466 int i;465 int i;
467 unsigned long bl;466 unsigned long bl;
@@ -497,13 +496,12 @@ int reiserfs_in_journal(struct super_block *sb, · 29 unmodified lines
497 bl = bmap_nr * (sb->s_blocksize << 3) + bit_nr;496 bl = bmap_nr * (sb->s_blocksize << 3) + bit_nr;
498 /* is it in any old transactions? */497 /* is it in any old transactions? */
499 if (search_all498 if (search_all
500 && (cn =499 && (get_journal_hash_dev(sb, journal->j_list_hash_table, bl))) {
501 get_journal_hash_dev(sb, journal->j_list_hash_table, bl))) {
502 return 1;500 return 1;
503 }501 }
504 502
505 /* is it in the current transaction. This should never happen */503 /* is it in the current transaction. This should never happen */
506 if ((cn = get_journal_hash_dev(sb, journal->j_hash_table, bl))) {504 if ((get_journal_hash_dev(sb, journal->j_hash_table, bl))) {
507 BUG();505 BUG();
508 return 1;506 return 1;
509 }507 }
include/linux/syscalls.h+2−0
@@ -483,6 +483,8 @@ asmlinkage long sys_pipe2(int __user *fildes, int flags); · 482 unmodified lines
483/* fs/quota.c */483/* fs/quota.c */
484asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special,484asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special,
485 qid_t id, void __user *addr);485 qid_t id, void __user *addr);
486asmlinkage long sys_quotactl_path(unsigned int cmd, const char __user *mountpoint,
487 qid_t id, void __user *addr);
486 488
487/* fs/readdir.c */489/* fs/readdir.c */
488asmlinkage long sys_getdents64(unsigned int fd,490asmlinkage long sys_getdents64(unsigned int fd,
include/uapi/asm-generic/unistd.h+3−1
@@ -863,9 +863,11 @@ __SYSCALL(__NR_process_madvise, sys_process_madvise) · 862 unmodified lines
863__SC_COMP(__NR_epoll_pwait2, sys_epoll_pwait2, compat_sys_epoll_pwait2)863__SC_COMP(__NR_epoll_pwait2, sys_epoll_pwait2, compat_sys_epoll_pwait2)
864#define __NR_mount_setattr 442864#define __NR_mount_setattr 442
865__SYSCALL(__NR_mount_setattr, sys_mount_setattr)865__SYSCALL(__NR_mount_setattr, sys_mount_setattr)
866#define __NR_quotactl_path 443
867__SYSCALL(__NR_quotactl_path, sys_quotactl_path)
866 868
867#undef __NR_syscalls869#undef __NR_syscalls
868#define __NR_syscalls 443870#define __NR_syscalls 444
869 871
870/*872/*
871 * 32 bit systems traditionally used different873 * 32 bit systems traditionally used different
include/uapi/linux/dqblk_xfs.h+4−1
@@ -219,7 +219,10 @@ struct fs_quota_statv { · 218 unmodified lines
219 __s32 qs_rtbtimelimit;/* limit for rt blks timer */219 __s32 qs_rtbtimelimit;/* limit for rt blks timer */
220 __u16 qs_bwarnlimit; /* limit for num warnings */220 __u16 qs_bwarnlimit; /* limit for num warnings */
221 __u16 qs_iwarnlimit; /* limit for num warnings */221 __u16 qs_iwarnlimit; /* limit for num warnings */
222 __u64 qs_pad2[8]; /* for future proofing */222 __u16 qs_rtbwarnlimit;/* limit for rt blks warnings */
223 __u16 qs_pad3;
224 __u32 qs_pad4;
225 __u64 qs_pad2[7]; /* for future proofing */
223};226};
224 227
225#endif /* _LINUX_DQBLK_XFS_H */228#endif /* _LINUX_DQBLK_XFS_H */
kernel/sys_ni.c+1−0
@@ -99,6 +99,7 @@ COND_SYSCALL(flock); · 98 unmodified lines
99 99
100/* fs/quota.c */100/* fs/quota.c */
101COND_SYSCALL(quotactl);101COND_SYSCALL(quotactl);
102COND_SYSCALL(quotactl_path);
102 103
103/* fs/readdir.c */104/* fs/readdir.c */
104 105

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t