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
Unified · Split
| @@ -482,3 +482,4 @@ · 481 unmodified lines | ||
| 482 | 482 | 550 common process_madvise sys_process_madvise |
| 483 | 483 | 551 common epoll_pwait2 sys_epoll_pwait2 |
| 484 | 484 | 552 common mount_setattr sys_mount_setattr |
| 485 | +553 common quotactl_path sys_quotactl_path | |
| @@ -456,3 +456,4 @@ · 455 unmodified lines | ||
| 456 | 456 | 440 common process_madvise sys_process_madvise |
| 457 | 457 | 441 common epoll_pwait2 sys_epoll_pwait2 |
| 458 | 458 | 442 common mount_setattr sys_mount_setattr |
| 459 | +443 common quotactl_path sys_quotactl_path | |
| @@ -38,7 +38,7 @@ · 37 unmodified lines | ||
| 38 | 38 | #define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5) |
| 39 | 39 | #define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800) |
| 40 | 40 | |
| 41 | −#define __NR_compat_syscalls 443 | |
| 41 | +#define __NR_compat_syscalls 444 | |
| 42 | 42 | #endif |
| 43 | 43 | |
| 44 | 44 | #define __ARCH_WANT_SYS_CLONE |
| @@ -893,6 +893,8 @@ __SYSCALL(__NR_process_madvise, sys_process_madvise) · 892 unmodified lines | ||
| 893 | 893 | __SYSCALL(__NR_epoll_pwait2, compat_sys_epoll_pwait2) |
| 894 | 894 | #define __NR_mount_setattr 442 |
| 895 | 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 | 900 | * Please add new compat syscalls above this comment and update |
| @@ -363,3 +363,4 @@ · 362 unmodified lines | ||
| 363 | 363 | 440 common process_madvise sys_process_madvise |
| 364 | 364 | 441 common epoll_pwait2 sys_epoll_pwait2 |
| 365 | 365 | 442 common mount_setattr sys_mount_setattr |
| 366 | +443 common quotactl_path sys_quotactl_path | |
| @@ -442,3 +442,4 @@ · 441 unmodified lines | ||
| 442 | 442 | 440 common process_madvise sys_process_madvise |
| 443 | 443 | 441 common epoll_pwait2 sys_epoll_pwait2 |
| 444 | 444 | 442 common mount_setattr sys_mount_setattr |
| 445 | +443 common quotactl_path sys_quotactl_path | |
| @@ -448,3 +448,4 @@ · 447 unmodified lines | ||
| 448 | 448 | 440 common process_madvise sys_process_madvise |
| 449 | 449 | 441 common epoll_pwait2 sys_epoll_pwait2 |
| 450 | 450 | 442 common mount_setattr sys_mount_setattr |
| 451 | +443 common quotactl_path sys_quotactl_path | |
| @@ -381,3 +381,4 @@ · 380 unmodified lines | ||
| 381 | 381 | 440 n32 process_madvise sys_process_madvise |
| 382 | 382 | 441 n32 epoll_pwait2 compat_sys_epoll_pwait2 |
| 383 | 383 | 442 n32 mount_setattr sys_mount_setattr |
| 384 | +443 n32 quotactl_path sys_quotactl_path | |
| @@ -357,3 +357,4 @@ · 356 unmodified lines | ||
| 357 | 357 | 440 n64 process_madvise sys_process_madvise |
| 358 | 358 | 441 n64 epoll_pwait2 sys_epoll_pwait2 |
| 359 | 359 | 442 n64 mount_setattr sys_mount_setattr |
| 360 | +443 n64 quotactl_path sys_quotactl_path | |
| @@ -430,3 +430,4 @@ · 429 unmodified lines | ||
| 430 | 430 | 440 o32 process_madvise sys_process_madvise |
| 431 | 431 | 441 o32 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 |
| 432 | 432 | 442 o32 mount_setattr sys_mount_setattr |
| 433 | +443 o32 quotactl_path sys_quotactl_path | |
| @@ -440,3 +440,4 @@ · 439 unmodified lines | ||
| 440 | 440 | 440 common process_madvise sys_process_madvise |
| 441 | 441 | 441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 |
| 442 | 442 | 442 common mount_setattr sys_mount_setattr |
| 443 | +443 common quotactl_path sys_quotactl_path | |
| @@ -522,3 +522,4 @@ · 521 unmodified lines | ||
| 522 | 522 | 440 common process_madvise sys_process_madvise |
| 523 | 523 | 441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 |
| 524 | 524 | 442 common mount_setattr sys_mount_setattr |
| 525 | +443 common quotactl_path sys_quotactl_path | |
| @@ -445,3 +445,4 @@ · 444 unmodified lines | ||
| 445 | 445 | 440 common process_madvise sys_process_madvise sys_process_madvise |
| 446 | 446 | 441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 |
| 447 | 447 | 442 common mount_setattr sys_mount_setattr sys_mount_setattr |
| 448 | +443 common quotactl_path sys_quotactl_path sys_quotactl_path | |
| @@ -445,3 +445,4 @@ · 444 unmodified lines | ||
| 445 | 445 | 440 common process_madvise sys_process_madvise |
| 446 | 446 | 441 common epoll_pwait2 sys_epoll_pwait2 |
| 447 | 447 | 442 common mount_setattr sys_mount_setattr |
| 448 | +443 common quotactl_path sys_quotactl_path | |
| @@ -488,3 +488,4 @@ · 487 unmodified lines | ||
| 488 | 488 | 440 common process_madvise sys_process_madvise |
| 489 | 489 | 441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 |
| 490 | 490 | 442 common mount_setattr sys_mount_setattr |
| 491 | +443 common quotactl_path sys_quotactl_path | |
| @@ -447,3 +447,4 @@ · 446 unmodified lines | ||
| 447 | 447 | 440 i386 process_madvise sys_process_madvise |
| 448 | 448 | 441 i386 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 |
| 449 | 449 | 442 i386 mount_setattr sys_mount_setattr |
| 450 | +443 i386 quotactl_path sys_quotactl_path | |
| @@ -364,6 +364,7 @@ · 363 unmodified lines | ||
| 364 | 364 | 440 common process_madvise sys_process_madvise |
| 365 | 365 | 441 common epoll_pwait2 sys_epoll_pwait2 |
| 366 | 366 | 442 common mount_setattr sys_mount_setattr |
| 367 | +443 common quotactl_path sys_quotactl_path | |
| 367 | 368 | |
| 368 | 369 | # |
| 369 | 370 | # Due to a historical design error, certain syscalls are numbered differently |
| @@ -413,3 +413,4 @@ · 412 unmodified lines | ||
| 413 | 413 | 440 common process_madvise sys_process_madvise |
| 414 | 414 | 441 common epoll_pwait2 sys_epoll_pwait2 |
| 415 | 415 | 442 common mount_setattr sys_mount_setattr |
| 416 | +443 common quotactl_path sys_quotactl_path | |
| @@ -190,13 +190,20 @@ fail: · 189 unmodified lines | ||
| 190 | 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 | + */ | |
| 193 | 200 | static struct page * ext2_get_page(struct inode *dir, unsigned long n, |
| 194 | − int quiet) | |
| 201 | + int quiet, void **page_addr) | |
| 195 | 202 | { |
| 196 | 203 | struct address_space *mapping = dir->i_mapping; |
| 197 | 204 | struct page *page = read_mapping_page(mapping, n, NULL); |
| 198 | 205 | if (!IS_ERR(page)) { |
| 199 | − kmap(page); | |
| 206 | + *page_addr = kmap_local_page(page); | |
| 200 | 207 | if (unlikely(!PageChecked(page))) { |
| 201 | 208 | if (PageError(page) || !ext2_check_page(page, quiet)) |
| 202 | 209 | goto fail; |
| @@ -205,7 +212,7 @@ static struct page * ext2_get_page(struct inode *dir, unsigned long n, · 2 unmodified lines | ||
| 205 | 212 | return page; |
| 206 | 213 | |
| 207 | 214 | fail: |
| 208 | − ext2_put_page(page); | |
| 215 | + ext2_put_page(page, *page_addr); | |
| 209 | 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 | 283 | for ( ; n < npages; n++, offset = 0) { |
| 277 | 284 | char *kaddr, *limit; |
| 278 | 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 | 288 | if (IS_ERR(page)) { |
| 282 | 289 | ext2_error(sb, __func__, |
| @@ -285,7 +292,6 @@ ext2_readdir(struct file *file, struct dir_context *ctx) · 2 unmodified lines | ||
| 285 | 292 | ctx->pos += PAGE_SIZE - offset; |
| 286 | 293 | return PTR_ERR(page); |
| 287 | 294 | } |
| 288 | − kaddr = page_address(page); | |
| 289 | 295 | if (unlikely(need_revalidate)) { |
| 290 | 296 | if (offset) { |
| 291 | 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 | 306 | if (de->rec_len == 0) { |
| 301 | 307 | ext2_error(sb, __func__, |
| 302 | 308 | "zero-length directory entry"); |
| 303 | − ext2_put_page(page); | |
| 309 | + ext2_put_page(page, kaddr); | |
| 304 | 310 | return -EIO; |
| 305 | 311 | } |
| 306 | 312 | if (de->inode) { |
| @@ -312,13 +318,13 @@ ext2_readdir(struct file *file, struct dir_context *ctx) · 5 unmodified lines | ||
| 312 | 318 | if (!dir_emit(ctx, de->name, de->name_len, |
| 313 | 319 | le32_to_cpu(de->inode), |
| 314 | 320 | d_type)) { |
| 315 | − ext2_put_page(page); | |
| 321 | + ext2_put_page(page, kaddr); | |
| 316 | 322 | return 0; |
| 317 | 323 | } |
| 318 | 324 | } |
| 319 | 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 | 329 | return 0; |
| 324 | 330 | } |
| @@ -332,9 +338,16 @@ ext2_readdir(struct file *file, struct dir_context *ctx) · 7 unmodified lines | ||
| 332 | 338 | * Entry is guaranteed to be valid. |
| 333 | 339 | * |
| 334 | 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 | */ |
| 336 | 348 | struct 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 | 352 | const char *name = child->name; |
| 340 | 353 | int namelen = child->len; |
| @@ -344,12 +357,14 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir, · 3 unmodified lines | ||
| 344 | 357 | struct page *page = NULL; |
| 345 | 358 | struct ext2_inode_info *ei = EXT2_I(dir); |
| 346 | 359 | ext2_dirent * de; |
| 360 | + void *page_addr; | |
| 347 | 361 | |
| 348 | 362 | if (npages == 0) |
| 349 | 363 | goto out; |
| 350 | 364 | |
| 351 | 365 | /* OFFSET_CACHE */ |
| 352 | 366 | *res_page = NULL; |
| 367 | + *res_page_addr = NULL; | |
| 353 | 368 | |
| 354 | 369 | start = ei->i_dir_start_lookup; |
| 355 | 370 | if (start >= npages) |
| @@ -357,25 +372,25 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir, · 1 unmodified line | ||
| 357 | 372 | n = start; |
| 358 | 373 | do { |
| 359 | 374 | char *kaddr; |
| 360 | − page = ext2_get_page(dir, n, 0); | |
| 375 | + page = ext2_get_page(dir, n, 0, &page_addr); | |
| 361 | 376 | if (IS_ERR(page)) |
| 362 | 377 | return ERR_CAST(page); |
| 363 | 378 | |
| 364 | − kaddr = page_address(page); | |
| 379 | + kaddr = page_addr; | |
| 365 | 380 | de = (ext2_dirent *) kaddr; |
| 366 | 381 | kaddr += ext2_last_byte(dir, n) - reclen; |
| 367 | 382 | while ((char *) de <= kaddr) { |
| 368 | 383 | if (de->rec_len == 0) { |
| 369 | 384 | ext2_error(dir->i_sb, __func__, |
| 370 | 385 | "zero-length directory entry"); |
| 371 | − ext2_put_page(page); | |
| 386 | + ext2_put_page(page, page_addr); | |
| 372 | 387 | goto out; |
| 373 | 388 | } |
| 374 | 389 | if (ext2_match(namelen, name, de)) |
| 375 | 390 | goto found; |
| 376 | 391 | de = ext2_next_entry(de); |
| 377 | 392 | } |
| 378 | − ext2_put_page(page); | |
| 393 | + ext2_put_page(page, page_addr); | |
| 379 | 394 | |
| 380 | 395 | if (++n >= npages) |
| 381 | 396 | n = 0; |
| @@ -393,6 +408,7 @@ out: · 11 unmodified lines | ||
| 393 | 408 | |
| 394 | 409 | found: |
| 395 | 410 | *res_page = page; |
| 411 | + *res_page_addr = page_addr; | |
| 396 | 412 | ei->i_dir_start_lookup = n; |
| 397 | 413 | return de; |
| 398 | 414 | } |
| @@ -402,15 +418,24 @@ found: · 3 unmodified lines | ||
| 402 | 418 | * (as a parameter - p). |
| 403 | 419 | * |
| 404 | 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 | */ |
| 406 | −struct ext2_dir_entry_2 * ext2_dotdot (struct inode *dir, struct page **p) | |
| 428 | +struct 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 | 433 | ext2_dirent *de = NULL; |
| 410 | 434 | |
| 411 | 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 | 437 | *p = page; |
| 438 | + *pa = page_addr; | |
| 414 | 439 | } |
| 415 | 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 | 445 | struct ext2_dir_entry_2 *de; |
| 421 | 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 | 450 | if (IS_ERR(de)) |
| 425 | 451 | return PTR_ERR(de); |
| 426 | 452 | |
| 427 | 453 | *ino = le32_to_cpu(de->inode); |
| 428 | − ext2_put_page(page); | |
| 454 | + ext2_put_page(page, page_addr); | |
| 429 | 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 | 460 | return __block_write_begin(page, pos, len, ext2_get_block); |
| 435 | 461 | } |
| 436 | 462 | |
| 437 | −/* Releases the page */ | |
| 438 | 463 | void 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 | 467 | loff_t pos = page_offset(page) + |
| 442 | − (char *) de - (char *) page_address(page); | |
| 468 | + (char *) de - (char *) page_addr; | |
| 443 | 469 | unsigned len = ext2_rec_len_from_disk(de->rec_len); |
| 444 | 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 | 475 | de->inode = cpu_to_le32(inode->i_ino); |
| 450 | 476 | ext2_set_de_type(de, inode); |
| 451 | 477 | err = ext2_commit_chunk(page, pos, len); |
| 452 | − ext2_put_page(page); | |
| 453 | 478 | if (update_times) |
| 454 | 479 | dir->i_mtime = dir->i_ctime = current_time(dir); |
| 455 | 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 | 493 | unsigned reclen = EXT2_DIR_REC_LEN(namelen); |
| 469 | 494 | unsigned short rec_len, name_len; |
| 470 | 495 | struct page *page = NULL; |
| 496 | + void *page_addr = NULL; | |
| 471 | 497 | ext2_dirent * de; |
| 472 | 498 | unsigned long npages = dir_pages(dir); |
| 473 | 499 | unsigned long n; |
| 474 | − char *kaddr; | |
| 475 | 500 | loff_t pos; |
| 476 | 501 | int err; |
| 477 | 502 | |
| @@ -481,14 +506,15 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode) · 3 unmodified lines | ||
| 481 | 506 | * to protect that region. |
| 482 | 507 | */ |
| 483 | 508 | for (n = 0; n <= npages; n++) { |
| 509 | + char *kaddr; | |
| 484 | 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 | 513 | err = PTR_ERR(page); |
| 488 | 514 | if (IS_ERR(page)) |
| 489 | 515 | goto out; |
| 490 | 516 | lock_page(page); |
| 491 | − kaddr = page_address(page); | |
| 517 | + kaddr = page_addr; | |
| 492 | 518 | dir_end = kaddr + ext2_last_byte(dir, n); |
| 493 | 519 | de = (ext2_dirent *)kaddr; |
| 494 | 520 | kaddr += PAGE_SIZE - reclen; |
| @@ -519,14 +545,14 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode) · 24 unmodified lines | ||
| 519 | 545 | de = (ext2_dirent *) ((char *) de + rec_len); |
| 520 | 546 | } |
| 521 | 547 | unlock_page(page); |
| 522 | − ext2_put_page(page); | |
| 548 | + ext2_put_page(page, page_addr); | |
| 523 | 549 | } |
| 524 | 550 | BUG(); |
| 525 | 551 | return -EINVAL; |
| 526 | 552 | |
| 527 | 553 | got_it: |
| 528 | 554 | pos = page_offset(page) + |
| 529 | − (char*)de - (char*)page_address(page); | |
| 555 | + (char *)de - (char *)page_addr; | |
| 530 | 556 | err = ext2_prepare_chunk(page, pos, rec_len); |
| 531 | 557 | if (err) |
| 532 | 558 | goto out_unlock; |
| @@ -546,7 +572,7 @@ got_it: · 13 unmodified lines | ||
| 546 | 572 | mark_inode_dirty(dir); |
| 547 | 573 | /* OFFSET_CACHE */ |
| 548 | 574 | out_put: |
| 549 | − ext2_put_page(page); | |
| 575 | + ext2_put_page(page, page_addr); | |
| 550 | 576 | out: |
| 551 | 577 | return err; |
| 552 | 578 | out_unlock: |
| @@ -556,7 +582,7 @@ out_unlock: · 3 unmodified lines | ||
| 556 | 582 | |
| 557 | 583 | /* |
| 558 | 584 | * 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 | */ |
| 561 | 587 | int 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 | 620 | EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL; |
| 595 | 621 | mark_inode_dirty(inode); |
| 596 | 622 | out: |
| 597 | − ext2_put_page(page); | |
| 598 | 623 | return err; |
| 599 | 624 | } |
| 600 | 625 | |
| @@ -644,6 +669,7 @@ fail: · 43 unmodified lines | ||
| 644 | 669 | */ |
| 645 | 670 | int ext2_empty_dir (struct inode * inode) |
| 646 | 671 | { |
| 672 | + void *page_addr = NULL; | |
| 647 | 673 | struct page *page = NULL; |
| 648 | 674 | unsigned long i, npages = dir_pages(inode); |
| 649 | 675 | int dir_has_error = 0; |
| @@ -651,14 +677,14 @@ int ext2_empty_dir (struct inode * inode) · 1 unmodified line | ||
| 651 | 677 | for (i = 0; i < npages; i++) { |
| 652 | 678 | char *kaddr; |
| 653 | 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 | 682 | if (IS_ERR(page)) { |
| 657 | 683 | dir_has_error = 1; |
| 658 | 684 | continue; |
| 659 | 685 | } |
| 660 | 686 | |
| 661 | − kaddr = page_address(page); | |
| 687 | + kaddr = page_addr; | |
| 662 | 688 | de = (ext2_dirent *)kaddr; |
| 663 | 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 | 711 | de = ext2_next_entry(de); |
| 686 | 712 | } |
| 687 | − ext2_put_page(page); | |
| 713 | + ext2_put_page(page, page_addr); | |
| 688 | 714 | } |
| 689 | 715 | return 1; |
| 690 | 716 | |
| 691 | 717 | not_empty: |
| 692 | − ext2_put_page(page); | |
| 718 | + ext2_put_page(page, page_addr); | |
| 693 | 719 | return 0; |
| 694 | 720 | } |
| 695 | 721 | |
| @@ -738,14 +738,16 @@ extern int ext2_add_link (struct dentry *, struct inode *); · 737 unmodified lines | ||
| 738 | 738 | extern int ext2_inode_by_name(struct inode *dir, |
| 739 | 739 | const struct qstr *child, ino_t *ino); |
| 740 | 740 | extern int ext2_make_empty(struct inode *, struct inode *); |
| 741 | −extern struct ext2_dir_entry_2 * ext2_find_entry (struct inode *,const struct qstr *, struct page **); | |
| 741 | +extern struct ext2_dir_entry_2 *ext2_find_entry(struct inode *, const struct qstr *, | |
| 742 | + struct page **, void **res_page_addr); | |
| 742 | 743 | extern int ext2_delete_entry (struct ext2_dir_entry_2 *, struct page *); |
| 743 | 744 | extern int ext2_empty_dir (struct inode *); |
| 744 | −extern struct ext2_dir_entry_2 * ext2_dotdot (struct inode *, struct page **); | |
| 745 | −extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, struct inode *, int); | |
| 746 | −static inline void ext2_put_page(struct page *page) | |
| 745 | +extern struct ext2_dir_entry_2 *ext2_dotdot(struct inode *dir, struct page **p, void **pa); | |
| 746 | +extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, void *, | |
| 747 | + struct inode *, int); | |
| 748 | +static inline void ext2_put_page(struct page *page, void *page_addr) | |
| 747 | 749 | { |
| 748 | − kunmap(page); | |
| 750 | + kunmap_local(page_addr); | |
| 749 | 751 | put_page(page); |
| 750 | 752 | } |
| 751 | 753 | |
| @@ -281,19 +281,21 @@ static int ext2_unlink(struct inode * dir, struct dentry *dentry) · 280 unmodified lines | ||
| 281 | 281 | struct inode * inode = d_inode(dentry); |
| 282 | 282 | struct ext2_dir_entry_2 * de; |
| 283 | 283 | struct page * page; |
| 284 | + void *page_addr; | |
| 284 | 285 | int err; |
| 285 | 286 | |
| 286 | 287 | err = dquot_initialize(dir); |
| 287 | 288 | if (err) |
| 288 | 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 | 292 | if (IS_ERR(de)) { |
| 292 | 293 | err = PTR_ERR(de); |
| 293 | 294 | goto out; |
| 294 | 295 | } |
| 295 | 296 | |
| 296 | 297 | err = ext2_delete_entry (de, page); |
| 298 | + ext2_put_page(page, page_addr); | |
| 297 | 299 | if (err) |
| 298 | 300 | goto out; |
| 299 | 301 | |
| @@ -328,8 +330,10 @@ static int ext2_rename (struct user_namespace * mnt_userns, · 28 unmodified lines | ||
| 328 | 330 | struct inode * old_inode = d_inode(old_dentry); |
| 329 | 331 | struct inode * new_inode = d_inode(new_dentry); |
| 330 | 332 | struct page * dir_page = NULL; |
| 333 | + void *dir_page_addr; | |
| 331 | 334 | struct ext2_dir_entry_2 * dir_de = NULL; |
| 332 | 335 | struct page * old_page; |
| 336 | + void *old_page_addr; | |
| 333 | 337 | struct ext2_dir_entry_2 * old_de; |
| 334 | 338 | int err; |
| 335 | 339 | |
| @@ -344,7 +348,8 @@ static int ext2_rename (struct user_namespace * mnt_userns, · 8 unmodified lines | ||
| 344 | 348 | if (err) |
| 345 | 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 | 353 | if (IS_ERR(old_de)) { |
| 349 | 354 | err = PTR_ERR(old_de); |
| 350 | 355 | goto out; |
| @@ -352,12 +357,13 @@ static int ext2_rename (struct user_namespace * mnt_userns, · 1 unmodified line | ||
| 352 | 357 | |
| 353 | 358 | if (S_ISDIR(old_inode->i_mode)) { |
| 354 | 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 | 361 | if (!dir_de) |
| 357 | 362 | goto out_old; |
| 358 | 363 | } |
| 359 | 364 | |
| 360 | 365 | if (new_inode) { |
| 366 | + void *page_addr; | |
| 361 | 367 | struct page *new_page; |
| 362 | 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 | 371 | if (dir_de && !ext2_empty_dir (new_inode)) |
| 366 | 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 | 376 | if (IS_ERR(new_de)) { |
| 370 | 377 | err = PTR_ERR(new_de); |
| 371 | 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 | 382 | new_inode->i_ctime = current_time(new_inode); |
| 375 | 383 | if (dir_de) |
| 376 | 384 | drop_nlink(new_inode); |
| @@ -390,23 +398,25 @@ static int ext2_rename (struct user_namespace * mnt_userns, · 13 unmodified lines | ||
| 390 | 398 | old_inode->i_ctime = current_time(old_inode); |
| 391 | 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 | 403 | if (dir_de) { |
| 396 | 404 | if (old_dir != new_dir) |
| 397 | − ext2_set_link(old_inode, dir_de, dir_page, new_dir, 0); | |
| 398 | − else | |
| 399 | − ext2_put_page(dir_page); | |
| 405 | + ext2_set_link(old_inode, dir_de, dir_page, | |
| 406 | + dir_page_addr, new_dir, 0); | |
| 407 | + | |
| 408 | + ext2_put_page(dir_page, dir_page_addr); | |
| 400 | 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 | |
| 405 | 415 | out_dir: |
| 406 | 416 | if (dir_de) |
| 407 | − ext2_put_page(dir_page); | |
| 417 | + ext2_put_page(dir_page, dir_page_addr); | |
| 408 | 418 | out_old: |
| 409 | − ext2_put_page(old_page); | |
| 419 | + ext2_put_page(old_page, old_page_addr); | |
| 410 | 420 | out: |
| 411 | 421 | return err; |
| 412 | 422 | } |
| @@ -1104,7 +1104,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) · 1103 unmodified lines | ||
| 1104 | 1104 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); |
| 1105 | 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 | 1108 | spin_lock_init(&sbi->s_rsv_window_lock); |
| 1109 | 1109 | sbi->s_rsv_window_root = RB_ROOT; |
| 1110 | 1110 | /* |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <linux/capability.h> |
| 18 | 18 | #include <linux/quotaops.h> |
| 19 | 19 | #include <linux/types.h> |
| 20 | +#include <linux/mount.h> | |
| 20 | 21 | #include <linux/writeback.h> |
| 21 | 22 | #include <linux/nospec.h> |
| 22 | 23 | #include "compat.h" |
| @@ -471,6 +472,7 @@ static int quota_getstatev(struct super_block *sb, int type, · 448 unmodified lines | ||
| 471 | 472 | fqs->qs_rtbtimelimit = state.s_state[type].rt_spc_timelimit; |
| 472 | 473 | fqs->qs_bwarnlimit = state.s_state[type].spc_warnlimit; |
| 473 | 474 | fqs->qs_iwarnlimit = state.s_state[type].ino_warnlimit; |
| 475 | + fqs->qs_rtbwarnlimit = state.s_state[type].rt_spc_warnlimit; | |
| 474 | 476 | |
| 475 | 477 | /* Inodes may be allocated even if inactive; copy out if present */ |
| 476 | 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 | 832 | /* Return 1 if 'cmd' will block on frozen filesystem */ |
| 833 | 833 | static 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 | 851 | return 1; |
| 852 | 852 | } |
| 853 | −#endif /* CONFIG_BLOCK */ | |
| 854 | 853 | |
| 855 | 854 | /* Return true if quotactl command is manipulating quota on/off state */ |
| 856 | 855 | static bool quotactl_cmd_onoff(int cmd) |
| @@ -968,3 +967,48 @@ out: · 111 unmodified lines | ||
| 968 | 967 | path_put(pathp); |
| 969 | 968 | return ret; |
| 970 | 969 | } |
| 970 | + | |
| 971 | +SYSCALL_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); | |
| 1010 | +out: | |
| 1011 | + path_put(&mountpath); | |
| 1012 | + | |
| 1013 | + return ret; | |
| 1014 | +} | |
| @@ -461,7 +461,6 @@ int reiserfs_in_journal(struct super_block *sb, · 460 unmodified lines | ||
| 461 | 461 | b_blocknr_t * next_zero_bit) |
| 462 | 462 | { |
| 463 | 463 | struct reiserfs_journal *journal = SB_JOURNAL(sb); |
| 464 | − struct reiserfs_journal_cnode *cn; | |
| 465 | 464 | struct reiserfs_list_bitmap *jb; |
| 466 | 465 | int i; |
| 467 | 466 | unsigned long bl; |
| @@ -497,13 +496,12 @@ int reiserfs_in_journal(struct super_block *sb, · 29 unmodified lines | ||
| 497 | 496 | bl = bmap_nr * (sb->s_blocksize << 3) + bit_nr; |
| 498 | 497 | /* is it in any old transactions? */ |
| 499 | 498 | if (search_all |
| 500 | − && (cn = | |
| 501 | − get_journal_hash_dev(sb, journal->j_list_hash_table, bl))) { | |
| 499 | + && (get_journal_hash_dev(sb, journal->j_list_hash_table, bl))) { | |
| 502 | 500 | return 1; |
| 503 | 501 | } |
| 504 | 502 | |
| 505 | 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 | 505 | BUG(); |
| 508 | 506 | return 1; |
| 509 | 507 | } |
| @@ -483,6 +483,8 @@ asmlinkage long sys_pipe2(int __user *fildes, int flags); · 482 unmodified lines | ||
| 483 | 483 | /* fs/quota.c */ |
| 484 | 484 | asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special, |
| 485 | 485 | qid_t id, void __user *addr); |
| 486 | +asmlinkage long sys_quotactl_path(unsigned int cmd, const char __user *mountpoint, | |
| 487 | + qid_t id, void __user *addr); | |
| 486 | 488 | |
| 487 | 489 | /* fs/readdir.c */ |
| 488 | 490 | asmlinkage long sys_getdents64(unsigned int fd, |
| @@ -863,9 +863,11 @@ __SYSCALL(__NR_process_madvise, sys_process_madvise) · 862 unmodified lines | ||
| 863 | 863 | __SC_COMP(__NR_epoll_pwait2, sys_epoll_pwait2, compat_sys_epoll_pwait2) |
| 864 | 864 | #define __NR_mount_setattr 442 |
| 865 | 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 | 869 | #undef __NR_syscalls |
| 868 | −#define __NR_syscalls 443 | |
| 870 | +#define __NR_syscalls 444 | |
| 869 | 871 | |
| 870 | 872 | /* |
| 871 | 873 | * 32 bit systems traditionally used different |
| @@ -219,7 +219,10 @@ struct fs_quota_statv { · 218 unmodified lines | ||
| 219 | 219 | __s32 qs_rtbtimelimit;/* limit for rt blks timer */ |
| 220 | 220 | __u16 qs_bwarnlimit; /* limit for num warnings */ |
| 221 | 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 | 228 | #endif /* _LINUX_DQBLK_XFS_H */ |
| @@ -99,6 +99,7 @@ COND_SYSCALL(flock); · 98 unmodified lines | ||
| 99 | 99 | |
| 100 | 100 | /* fs/quota.c */ |
| 101 | 101 | COND_SYSCALL(quotactl); |
| 102 | +COND_SYSCALL(quotactl_path); | |
| 102 | 103 | |
| 103 | 104 | /* fs/readdir.c */ |
| 104 | 105 | |