Commit 767fcbc8 authored by Linus Torvalds's avatar Linus Torvalds

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
parents d2b6f8a1 a3cc754a
...@@ -482,3 +482,4 @@ ...@@ -482,3 +482,4 @@
550 common process_madvise sys_process_madvise 550 common process_madvise sys_process_madvise
551 common epoll_pwait2 sys_epoll_pwait2 551 common epoll_pwait2 sys_epoll_pwait2
552 common mount_setattr sys_mount_setattr 552 common mount_setattr sys_mount_setattr
553 common quotactl_path sys_quotactl_path
...@@ -456,3 +456,4 @@ ...@@ -456,3 +456,4 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
443 common quotactl_path sys_quotactl_path
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5) #define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5)
#define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800) #define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800)
#define __NR_compat_syscalls 443 #define __NR_compat_syscalls 444
#endif #endif
#define __ARCH_WANT_SYS_CLONE #define __ARCH_WANT_SYS_CLONE
......
...@@ -893,6 +893,8 @@ __SYSCALL(__NR_process_madvise, sys_process_madvise) ...@@ -893,6 +893,8 @@ __SYSCALL(__NR_process_madvise, sys_process_madvise)
__SYSCALL(__NR_epoll_pwait2, compat_sys_epoll_pwait2) __SYSCALL(__NR_epoll_pwait2, compat_sys_epoll_pwait2)
#define __NR_mount_setattr 442 #define __NR_mount_setattr 442
__SYSCALL(__NR_mount_setattr, sys_mount_setattr) __SYSCALL(__NR_mount_setattr, sys_mount_setattr)
#define __NR_quotactl_path 443
__SYSCALL(__NR_quotactl_path, sys_quotactl_path)
/* /*
* Please add new compat syscalls above this comment and update * Please add new compat syscalls above this comment and update
......
...@@ -363,3 +363,4 @@ ...@@ -363,3 +363,4 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
443 common quotactl_path sys_quotactl_path
...@@ -442,3 +442,4 @@ ...@@ -442,3 +442,4 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
443 common quotactl_path sys_quotactl_path
...@@ -448,3 +448,4 @@ ...@@ -448,3 +448,4 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
443 common quotactl_path sys_quotactl_path
...@@ -381,3 +381,4 @@ ...@@ -381,3 +381,4 @@
440 n32 process_madvise sys_process_madvise 440 n32 process_madvise sys_process_madvise
441 n32 epoll_pwait2 compat_sys_epoll_pwait2 441 n32 epoll_pwait2 compat_sys_epoll_pwait2
442 n32 mount_setattr sys_mount_setattr 442 n32 mount_setattr sys_mount_setattr
443 n32 quotactl_path sys_quotactl_path
...@@ -357,3 +357,4 @@ ...@@ -357,3 +357,4 @@
440 n64 process_madvise sys_process_madvise 440 n64 process_madvise sys_process_madvise
441 n64 epoll_pwait2 sys_epoll_pwait2 441 n64 epoll_pwait2 sys_epoll_pwait2
442 n64 mount_setattr sys_mount_setattr 442 n64 mount_setattr sys_mount_setattr
443 n64 quotactl_path sys_quotactl_path
...@@ -430,3 +430,4 @@ ...@@ -430,3 +430,4 @@
440 o32 process_madvise sys_process_madvise 440 o32 process_madvise sys_process_madvise
441 o32 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 441 o32 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
442 o32 mount_setattr sys_mount_setattr 442 o32 mount_setattr sys_mount_setattr
443 o32 quotactl_path sys_quotactl_path
...@@ -440,3 +440,4 @@ ...@@ -440,3 +440,4 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
443 common quotactl_path sys_quotactl_path
...@@ -522,3 +522,4 @@ ...@@ -522,3 +522,4 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
443 common quotactl_path sys_quotactl_path
...@@ -445,3 +445,4 @@ ...@@ -445,3 +445,4 @@
440 common process_madvise sys_process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr sys_mount_setattr
443 common quotactl_path sys_quotactl_path sys_quotactl_path
...@@ -445,3 +445,4 @@ ...@@ -445,3 +445,4 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
443 common quotactl_path sys_quotactl_path
...@@ -488,3 +488,4 @@ ...@@ -488,3 +488,4 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
443 common quotactl_path sys_quotactl_path
...@@ -447,3 +447,4 @@ ...@@ -447,3 +447,4 @@
440 i386 process_madvise sys_process_madvise 440 i386 process_madvise sys_process_madvise
441 i386 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 441 i386 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
442 i386 mount_setattr sys_mount_setattr 442 i386 mount_setattr sys_mount_setattr
443 i386 quotactl_path sys_quotactl_path
...@@ -364,6 +364,7 @@ ...@@ -364,6 +364,7 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
443 common quotactl_path sys_quotactl_path
# #
# Due to a historical design error, certain syscalls are numbered differently # Due to a historical design error, certain syscalls are numbered differently
......
...@@ -413,3 +413,4 @@ ...@@ -413,3 +413,4 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
443 common quotactl_path sys_quotactl_path
...@@ -190,13 +190,20 @@ static bool ext2_check_page(struct page *page, int quiet) ...@@ -190,13 +190,20 @@ static bool ext2_check_page(struct page *page, int quiet)
return false; return false;
} }
/*
* Calls to ext2_get_page()/ext2_put_page() must be nested according to the
* rules documented in kmap_local_page()/kunmap_local().
*
* NOTE: ext2_find_entry() and ext2_dotdot() act as a call to ext2_get_page()
* and should be treated as a call to ext2_get_page() for nesting purposes.
*/
static struct page * ext2_get_page(struct inode *dir, unsigned long n, static struct page * ext2_get_page(struct inode *dir, unsigned long n,
int quiet) int quiet, void **page_addr)
{ {
struct address_space *mapping = dir->i_mapping; struct address_space *mapping = dir->i_mapping;
struct page *page = read_mapping_page(mapping, n, NULL); struct page *page = read_mapping_page(mapping, n, NULL);
if (!IS_ERR(page)) { if (!IS_ERR(page)) {
kmap(page); *page_addr = kmap_local_page(page);
if (unlikely(!PageChecked(page))) { if (unlikely(!PageChecked(page))) {
if (PageError(page) || !ext2_check_page(page, quiet)) if (PageError(page) || !ext2_check_page(page, quiet))
goto fail; goto fail;
...@@ -205,7 +212,7 @@ static struct page * ext2_get_page(struct inode *dir, unsigned long n, ...@@ -205,7 +212,7 @@ static struct page * ext2_get_page(struct inode *dir, unsigned long n,
return page; return page;
fail: fail:
ext2_put_page(page); ext2_put_page(page, *page_addr);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
} }
...@@ -276,7 +283,7 @@ ext2_readdir(struct file *file, struct dir_context *ctx) ...@@ -276,7 +283,7 @@ ext2_readdir(struct file *file, struct dir_context *ctx)
for ( ; n < npages; n++, offset = 0) { for ( ; n < npages; n++, offset = 0) {
char *kaddr, *limit; char *kaddr, *limit;
ext2_dirent *de; ext2_dirent *de;
struct page *page = ext2_get_page(inode, n, 0); struct page *page = ext2_get_page(inode, n, 0, (void **)&kaddr);
if (IS_ERR(page)) { if (IS_ERR(page)) {
ext2_error(sb, __func__, ext2_error(sb, __func__,
...@@ -285,7 +292,6 @@ ext2_readdir(struct file *file, struct dir_context *ctx) ...@@ -285,7 +292,6 @@ ext2_readdir(struct file *file, struct dir_context *ctx)
ctx->pos += PAGE_SIZE - offset; ctx->pos += PAGE_SIZE - offset;
return PTR_ERR(page); return PTR_ERR(page);
} }
kaddr = page_address(page);
if (unlikely(need_revalidate)) { if (unlikely(need_revalidate)) {
if (offset) { if (offset) {
offset = ext2_validate_entry(kaddr, offset, chunk_mask); offset = ext2_validate_entry(kaddr, offset, chunk_mask);
...@@ -300,7 +306,7 @@ ext2_readdir(struct file *file, struct dir_context *ctx) ...@@ -300,7 +306,7 @@ ext2_readdir(struct file *file, struct dir_context *ctx)
if (de->rec_len == 0) { if (de->rec_len == 0) {
ext2_error(sb, __func__, ext2_error(sb, __func__,
"zero-length directory entry"); "zero-length directory entry");
ext2_put_page(page); ext2_put_page(page, kaddr);
return -EIO; return -EIO;
} }
if (de->inode) { if (de->inode) {
...@@ -312,13 +318,13 @@ ext2_readdir(struct file *file, struct dir_context *ctx) ...@@ -312,13 +318,13 @@ ext2_readdir(struct file *file, struct dir_context *ctx)
if (!dir_emit(ctx, de->name, de->name_len, if (!dir_emit(ctx, de->name, de->name_len,
le32_to_cpu(de->inode), le32_to_cpu(de->inode),
d_type)) { d_type)) {
ext2_put_page(page); ext2_put_page(page, kaddr);
return 0; return 0;
} }
} }
ctx->pos += ext2_rec_len_from_disk(de->rec_len); ctx->pos += ext2_rec_len_from_disk(de->rec_len);
} }
ext2_put_page(page); ext2_put_page(page, kaddr);
} }
return 0; return 0;
} }
...@@ -332,9 +338,16 @@ ext2_readdir(struct file *file, struct dir_context *ctx) ...@@ -332,9 +338,16 @@ ext2_readdir(struct file *file, struct dir_context *ctx)
* Entry is guaranteed to be valid. * Entry is guaranteed to be valid.
* *
* On Success ext2_put_page() should be called on *res_page. * On Success ext2_put_page() should be called on *res_page.
*
* NOTE: Calls to ext2_get_page()/ext2_put_page() must be nested according to
* the rules documented in kmap_local_page()/kunmap_local().
*
* ext2_find_entry() and ext2_dotdot() act as a call to ext2_get_page() and
* should be treated as a call to ext2_get_page() for nesting purposes.
*/ */
struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir, struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir,
const struct qstr *child, struct page **res_page) const struct qstr *child, struct page **res_page,
void **res_page_addr)
{ {
const char *name = child->name; const char *name = child->name;
int namelen = child->len; int namelen = child->len;
...@@ -344,12 +357,14 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir, ...@@ -344,12 +357,14 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir,
struct page *page = NULL; struct page *page = NULL;
struct ext2_inode_info *ei = EXT2_I(dir); struct ext2_inode_info *ei = EXT2_I(dir);
ext2_dirent * de; ext2_dirent * de;
void *page_addr;
if (npages == 0) if (npages == 0)
goto out; goto out;
/* OFFSET_CACHE */ /* OFFSET_CACHE */
*res_page = NULL; *res_page = NULL;
*res_page_addr = NULL;
start = ei->i_dir_start_lookup; start = ei->i_dir_start_lookup;
if (start >= npages) if (start >= npages)
...@@ -357,25 +372,25 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir, ...@@ -357,25 +372,25 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir,
n = start; n = start;
do { do {
char *kaddr; char *kaddr;
page = ext2_get_page(dir, n, 0); page = ext2_get_page(dir, n, 0, &page_addr);
if (IS_ERR(page)) if (IS_ERR(page))
return ERR_CAST(page); return ERR_CAST(page);
kaddr = page_address(page); kaddr = page_addr;
de = (ext2_dirent *) kaddr; de = (ext2_dirent *) kaddr;
kaddr += ext2_last_byte(dir, n) - reclen; kaddr += ext2_last_byte(dir, n) - reclen;
while ((char *) de <= kaddr) { while ((char *) de <= kaddr) {
if (de->rec_len == 0) { if (de->rec_len == 0) {
ext2_error(dir->i_sb, __func__, ext2_error(dir->i_sb, __func__,
"zero-length directory entry"); "zero-length directory entry");
ext2_put_page(page); ext2_put_page(page, page_addr);
goto out; goto out;
} }
if (ext2_match(namelen, name, de)) if (ext2_match(namelen, name, de))
goto found; goto found;
de = ext2_next_entry(de); de = ext2_next_entry(de);
} }
ext2_put_page(page); ext2_put_page(page, page_addr);
if (++n >= npages) if (++n >= npages)
n = 0; n = 0;
...@@ -393,6 +408,7 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir, ...@@ -393,6 +408,7 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir,
found: found:
*res_page = page; *res_page = page;
*res_page_addr = page_addr;
ei->i_dir_start_lookup = n; ei->i_dir_start_lookup = n;
return de; return de;
} }
...@@ -402,15 +418,24 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir, ...@@ -402,15 +418,24 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir,
* (as a parameter - p). * (as a parameter - p).
* *
* On Success ext2_put_page() should be called on *p. * On Success ext2_put_page() should be called on *p.
*
* NOTE: Calls to ext2_get_page()/ext2_put_page() must be nested according to
* the rules documented in kmap_local_page()/kunmap_local().
*
* ext2_find_entry() and ext2_dotdot() act as a call to ext2_get_page() and
* should be treated as a call to ext2_get_page() for nesting purposes.
*/ */
struct ext2_dir_entry_2 * ext2_dotdot (struct inode *dir, struct page **p) struct ext2_dir_entry_2 *ext2_dotdot(struct inode *dir, struct page **p,
void **pa)
{ {
struct page *page = ext2_get_page(dir, 0, 0); void *page_addr;
struct page *page = ext2_get_page(dir, 0, 0, &page_addr);
ext2_dirent *de = NULL; ext2_dirent *de = NULL;
if (!IS_ERR(page)) { if (!IS_ERR(page)) {
de = ext2_next_entry((ext2_dirent *) page_address(page)); de = ext2_next_entry((ext2_dirent *) page_addr);
*p = page; *p = page;
*pa = page_addr;
} }
return de; return de;
} }
...@@ -419,13 +444,14 @@ int ext2_inode_by_name(struct inode *dir, const struct qstr *child, ino_t *ino) ...@@ -419,13 +444,14 @@ int ext2_inode_by_name(struct inode *dir, const struct qstr *child, ino_t *ino)
{ {
struct ext2_dir_entry_2 *de; struct ext2_dir_entry_2 *de;
struct page *page; struct page *page;
void *page_addr;
de = ext2_find_entry(dir, child, &page); de = ext2_find_entry(dir, child, &page, &page_addr);
if (IS_ERR(de)) if (IS_ERR(de))
return PTR_ERR(de); return PTR_ERR(de);
*ino = le32_to_cpu(de->inode); *ino = le32_to_cpu(de->inode);
ext2_put_page(page); ext2_put_page(page, page_addr);
return 0; return 0;
} }
...@@ -434,12 +460,12 @@ static int ext2_prepare_chunk(struct page *page, loff_t pos, unsigned len) ...@@ -434,12 +460,12 @@ static int ext2_prepare_chunk(struct page *page, loff_t pos, unsigned len)
return __block_write_begin(page, pos, len, ext2_get_block); return __block_write_begin(page, pos, len, ext2_get_block);
} }
/* Releases the page */
void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de, void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
struct page *page, struct inode *inode, int update_times) struct page *page, void *page_addr, struct inode *inode,
int update_times)
{ {
loff_t pos = page_offset(page) + loff_t pos = page_offset(page) +
(char *) de - (char *) page_address(page); (char *) de - (char *) page_addr;
unsigned len = ext2_rec_len_from_disk(de->rec_len); unsigned len = ext2_rec_len_from_disk(de->rec_len);
int err; int err;
...@@ -449,7 +475,6 @@ void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de, ...@@ -449,7 +475,6 @@ void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
de->inode = cpu_to_le32(inode->i_ino); de->inode = cpu_to_le32(inode->i_ino);
ext2_set_de_type(de, inode); ext2_set_de_type(de, inode);
err = ext2_commit_chunk(page, pos, len); err = ext2_commit_chunk(page, pos, len);
ext2_put_page(page);
if (update_times) if (update_times)
dir->i_mtime = dir->i_ctime = current_time(dir); dir->i_mtime = dir->i_ctime = current_time(dir);
EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL; EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
...@@ -468,10 +493,10 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode) ...@@ -468,10 +493,10 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode)
unsigned reclen = EXT2_DIR_REC_LEN(namelen); unsigned reclen = EXT2_DIR_REC_LEN(namelen);
unsigned short rec_len, name_len; unsigned short rec_len, name_len;
struct page *page = NULL; struct page *page = NULL;
void *page_addr = NULL;
ext2_dirent * de; ext2_dirent * de;
unsigned long npages = dir_pages(dir); unsigned long npages = dir_pages(dir);
unsigned long n; unsigned long n;
char *kaddr;
loff_t pos; loff_t pos;
int err; int err;
...@@ -481,14 +506,15 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode) ...@@ -481,14 +506,15 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode)
* to protect that region. * to protect that region.
*/ */
for (n = 0; n <= npages; n++) { for (n = 0; n <= npages; n++) {
char *kaddr;
char *dir_end; char *dir_end;
page = ext2_get_page(dir, n, 0); page = ext2_get_page(dir, n, 0, &page_addr);
err = PTR_ERR(page); err = PTR_ERR(page);
if (IS_ERR(page)) if (IS_ERR(page))
goto out; goto out;
lock_page(page); lock_page(page);
kaddr = page_address(page); kaddr = page_addr;
dir_end = kaddr + ext2_last_byte(dir, n); dir_end = kaddr + ext2_last_byte(dir, n);
de = (ext2_dirent *)kaddr; de = (ext2_dirent *)kaddr;
kaddr += PAGE_SIZE - reclen; kaddr += PAGE_SIZE - reclen;
...@@ -519,14 +545,14 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode) ...@@ -519,14 +545,14 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode)
de = (ext2_dirent *) ((char *) de + rec_len); de = (ext2_dirent *) ((char *) de + rec_len);
} }
unlock_page(page); unlock_page(page);
ext2_put_page(page); ext2_put_page(page, page_addr);
} }
BUG(); BUG();
return -EINVAL; return -EINVAL;
got_it: got_it:
pos = page_offset(page) + pos = page_offset(page) +
(char*)de - (char*)page_address(page); (char *)de - (char *)page_addr;
err = ext2_prepare_chunk(page, pos, rec_len); err = ext2_prepare_chunk(page, pos, rec_len);
if (err) if (err)
goto out_unlock; goto out_unlock;
...@@ -546,7 +572,7 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode) ...@@ -546,7 +572,7 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode)
mark_inode_dirty(dir); mark_inode_dirty(dir);
/* OFFSET_CACHE */ /* OFFSET_CACHE */
out_put: out_put:
ext2_put_page(page); ext2_put_page(page, page_addr);
out: out:
return err; return err;
out_unlock: out_unlock:
...@@ -556,7 +582,7 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode) ...@@ -556,7 +582,7 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode)
/* /*
* ext2_delete_entry deletes a directory entry by merging it with the * ext2_delete_entry deletes a directory entry by merging it with the
* previous entry. Page is up-to-date. Releases the page. * previous entry. Page is up-to-date.
*/ */
int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page ) int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )
{ {
...@@ -594,7 +620,6 @@ int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page ) ...@@ -594,7 +620,6 @@ int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )
EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL; EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL;
mark_inode_dirty(inode); mark_inode_dirty(inode);
out: out:
ext2_put_page(page);
return err; return err;
} }
...@@ -644,6 +669,7 @@ int ext2_make_empty(struct inode *inode, struct inode *parent) ...@@ -644,6 +669,7 @@ int ext2_make_empty(struct inode *inode, struct inode *parent)
*/ */
int ext2_empty_dir (struct inode * inode) int ext2_empty_dir (struct inode * inode)
{ {
void *page_addr = NULL;
struct page *page = NULL; struct page *page = NULL;
unsigned long i, npages = dir_pages(inode); unsigned long i, npages = dir_pages(inode);
int dir_has_error = 0; int dir_has_error = 0;
...@@ -651,14 +677,14 @@ int ext2_empty_dir (struct inode * inode) ...@@ -651,14 +677,14 @@ int ext2_empty_dir (struct inode * inode)
for (i = 0; i < npages; i++) { for (i = 0; i < npages; i++) {
char *kaddr; char *kaddr;
ext2_dirent * de; ext2_dirent * de;
page = ext2_get_page(inode, i, dir_has_error); page = ext2_get_page(inode, i, dir_has_error, &page_addr);
if (IS_ERR(page)) { if (IS_ERR(page)) {
dir_has_error = 1; dir_has_error = 1;
continue; continue;
} }
kaddr = page_address(page); kaddr = page_addr;
de = (ext2_dirent *)kaddr; de = (ext2_dirent *)kaddr;
kaddr += ext2_last_byte(inode, i) - EXT2_DIR_REC_LEN(1); kaddr += ext2_last_byte(inode, i) - EXT2_DIR_REC_LEN(1);
...@@ -684,12 +710,12 @@ int ext2_empty_dir (struct inode * inode) ...@@ -684,12 +710,12 @@ int ext2_empty_dir (struct inode * inode)
} }
de = ext2_next_entry(de); de = ext2_next_entry(de);
} }
ext2_put_page(page); ext2_put_page(page, page_addr);
} }
return 1; return 1;
not_empty: not_empty:
ext2_put_page(page); ext2_put_page(page, page_addr);
return 0; return 0;
} }
......
...@@ -738,14 +738,16 @@ extern int ext2_add_link (struct dentry *, struct inode *); ...@@ -738,14 +738,16 @@ extern int ext2_add_link (struct dentry *, struct inode *);
extern int ext2_inode_by_name(struct inode *dir, extern int ext2_inode_by_name(struct inode *dir,
const struct qstr *child, ino_t *ino); const struct qstr *child, ino_t *ino);
extern int ext2_make_empty(struct inode *, struct inode *); extern int ext2_make_empty(struct inode *, struct inode *);
extern struct ext2_dir_entry_2 * ext2_find_entry (struct inode *,const struct qstr *, struct page **); extern struct ext2_dir_entry_2 *ext2_find_entry(struct inode *, const struct qstr *,
struct page **, void **res_page_addr);
extern int ext2_delete_entry (struct ext2_dir_entry_2 *, struct page *); extern int ext2_delete_entry (struct ext2_dir_entry_2 *, struct page *);
extern int ext2_empty_dir (struct inode *); extern int ext2_empty_dir (struct inode *);
extern struct ext2_dir_entry_2 * ext2_dotdot (struct inode *, struct page **); extern struct ext2_dir_entry_2 *ext2_dotdot(struct inode *dir, struct page **p, void **pa);
extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, struct inode *, int); extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, void *,
static inline void ext2_put_page(struct page *page) struct inode *, int);
static inline void ext2_put_page(struct page *page, void *page_addr)
{ {
kunmap(page); kunmap_local(page_addr);
put_page(page); put_page(page);
} }
......
...@@ -281,19 +281,21 @@ static int ext2_unlink(struct inode * dir, struct dentry *dentry) ...@@ -281,19 +281,21 @@ static int ext2_unlink(struct inode * dir, struct dentry *dentry)
struct inode * inode = d_inode(dentry); struct inode * inode = d_inode(dentry);
struct ext2_dir_entry_2 * de; struct ext2_dir_entry_2 * de;
struct page * page; struct page * page;
void *page_addr;
int err; int err;
err = dquot_initialize(dir); err = dquot_initialize(dir);
if (err) if (err)
goto out; goto out;
de = ext2_find_entry(dir, &dentry->d_name, &page); de = ext2_find_entry(dir, &dentry->d_name, &page, &page_addr);
if (IS_ERR(de)) { if (IS_ERR(de)) {
err = PTR_ERR(de); err = PTR_ERR(de);
goto out; goto out;
} }
err = ext2_delete_entry (de, page); err = ext2_delete_entry (de, page);
ext2_put_page(page, page_addr);
if (err) if (err)
goto out; goto out;
...@@ -328,8 +330,10 @@ static int ext2_rename (struct user_namespace * mnt_userns, ...@@ -328,8 +330,10 @@ static int ext2_rename (struct user_namespace * mnt_userns,
struct inode * old_inode = d_inode(old_dentry); struct inode * old_inode = d_inode(old_dentry);
struct inode * new_inode = d_inode(new_dentry); struct inode * new_inode = d_inode(new_dentry);
struct page * dir_page = NULL; struct page * dir_page = NULL;
void *dir_page_addr;
struct ext2_dir_entry_2 * dir_de = NULL; struct ext2_dir_entry_2 * dir_de = NULL;
struct page * old_page; struct page * old_page;
void *old_page_addr;
struct ext2_dir_entry_2 * old_de; struct ext2_dir_entry_2 * old_de;
int err; int err;
...@@ -344,7 +348,8 @@ static int ext2_rename (struct user_namespace * mnt_userns, ...@@ -344,7 +348,8 @@ static int ext2_rename (struct user_namespace * mnt_userns,
if (err) if (err)
goto out; goto out;
old_de = ext2_find_entry(old_dir, &old_dentry->d_name, &old_page); old_de = ext2_find_entry(old_dir, &old_dentry->d_name, &old_page,
&old_page_addr);
if (IS_ERR(old_de)) { if (IS_ERR(old_de)) {
err = PTR_ERR(old_de); err = PTR_ERR(old_de);
goto out; goto out;
...@@ -352,12 +357,13 @@ static int ext2_rename (struct user_namespace * mnt_userns, ...@@ -352,12 +357,13 @@ static int ext2_rename (struct user_namespace * mnt_userns,
if (S_ISDIR(old_inode->i_mode)) { if (S_ISDIR(old_inode->i_mode)) {
err = -EIO; err = -EIO;
dir_de = ext2_dotdot(old_inode, &dir_page); dir_de = ext2_dotdot(old_inode, &dir_page, &dir_page_addr);
if (!dir_de) if (!dir_de)
goto out_old; goto out_old;
} }
if (new_inode) { if (new_inode) {
void *page_addr;
struct page *new_page; struct page *new_page;
struct ext2_dir_entry_2 *new_de; struct ext2_dir_entry_2 *new_de;
...@@ -365,12 +371,14 @@ static int ext2_rename (struct user_namespace * mnt_userns, ...@@ -365,12 +371,14 @@ static int ext2_rename (struct user_namespace * mnt_userns,
if (dir_de && !ext2_empty_dir (new_inode)) if (dir_de && !ext2_empty_dir (new_inode))
goto out_dir; goto out_dir;
new_de = ext2_find_entry(new_dir, &new_dentry->d_name, &new_page); new_de = ext2_find_entry(new_dir, &new_dentry->d_name,
&new_page, &page_addr);
if (IS_ERR(new_de)) { if (IS_ERR(new_de)) {
err = PTR_ERR(new_de); err = PTR_ERR(new_de);
goto out_dir; goto out_dir;
} }
ext2_set_link(new_dir, new_de, new_page, old_inode, 1); ext2_set_link(new_dir, new_de, new_page, page_addr, old_inode, 1);
ext2_put_page(new_page, page_addr);
new_inode->i_ctime = current_time(new_inode); new_inode->i_ctime = current_time(new_inode);
if (dir_de) if (dir_de)
drop_nlink(new_inode); drop_nlink(new_inode);
...@@ -390,23 +398,25 @@ static int ext2_rename (struct user_namespace * mnt_userns, ...@@ -390,23 +398,25 @@ static int ext2_rename (struct user_namespace * mnt_userns,
old_inode->i_ctime = current_time(old_inode); old_inode->i_ctime = current_time(old_inode);
mark_inode_dirty(old_inode); mark_inode_dirty(old_inode);
ext2_delete_entry (old_de, old_page); ext2_delete_entry(old_de, old_page);
if (dir_de) { if (dir_de) {
if (old_dir != new_dir) if (old_dir != new_dir)
ext2_set_link(old_inode, dir_de, dir_page, new_dir, 0); ext2_set_link(old_inode, dir_de, dir_page,
else dir_page_addr, new_dir, 0);
ext2_put_page(dir_page);
ext2_put_page(dir_page, dir_page_addr);
inode_dec_link_count(old_dir); inode_dec_link_count(old_dir);
} }
return 0;
ext2_put_page(old_page, old_page_addr);
return 0;
out_dir: out_dir:
if (dir_de) if (dir_de)
ext2_put_page(dir_page); ext2_put_page(dir_page, dir_page_addr);
out_old: out_old:
ext2_put_page(old_page); ext2_put_page(old_page, old_page_addr);
out: out:
return err; return err;
} }
......
...@@ -1104,7 +1104,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1104,7 +1104,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
get_random_bytes(&sbi->s_next_generation, sizeof(u32)); get_random_bytes(&sbi->s_next_generation, sizeof(u32));
spin_lock_init(&sbi->s_next_gen_lock); spin_lock_init(&sbi->s_next_gen_lock);
/* per fileystem reservation list head & lock */ /* per filesystem reservation list head & lock */
spin_lock_init(&sbi->s_rsv_window_lock); spin_lock_init(&sbi->s_rsv_window_lock);
sbi->s_rsv_window_root = RB_ROOT; sbi->s_rsv_window_root = RB_ROOT;
/* /*
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/quotaops.h> #include <linux/quotaops.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/mount.h>
#include <linux/writeback.h> #include <linux/writeback.h>
#include <linux/nospec.h> #include <linux/nospec.h>
#include "compat.h" #include "compat.h"
...@@ -471,6 +472,7 @@ static int quota_getstatev(struct super_block *sb, int type, ...@@ -471,6 +472,7 @@ static int quota_getstatev(struct super_block *sb, int type,
fqs->qs_rtbtimelimit = state.s_state[type].rt_spc_timelimit; fqs->qs_rtbtimelimit = state.s_state[type].rt_spc_timelimit;
fqs->qs_bwarnlimit = state.s_state[type].spc_warnlimit; fqs->qs_bwarnlimit = state.s_state[type].spc_warnlimit;
fqs->qs_iwarnlimit = state.s_state[type].ino_warnlimit; fqs->qs_iwarnlimit = state.s_state[type].ino_warnlimit;
fqs->qs_rtbwarnlimit = state.s_state[type].rt_spc_warnlimit;
/* Inodes may be allocated even if inactive; copy out if present */ /* Inodes may be allocated even if inactive; copy out if present */
if (state.s_state[USRQUOTA].ino) { 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, ...@@ -827,8 +829,6 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
} }
} }
#ifdef CONFIG_BLOCK
/* Return 1 if 'cmd' will block on frozen filesystem */ /* Return 1 if 'cmd' will block on frozen filesystem */
static int quotactl_cmd_write(int cmd) static int quotactl_cmd_write(int cmd)
{ {
...@@ -850,7 +850,6 @@ static int quotactl_cmd_write(int cmd) ...@@ -850,7 +850,6 @@ static int quotactl_cmd_write(int cmd)
} }
return 1; return 1;
} }
#endif /* CONFIG_BLOCK */
/* Return true if quotactl command is manipulating quota on/off state */ /* Return true if quotactl command is manipulating quota on/off state */
static bool quotactl_cmd_onoff(int cmd) static bool quotactl_cmd_onoff(int cmd)
...@@ -968,3 +967,48 @@ SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special, ...@@ -968,3 +967,48 @@ SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special,
path_put(pathp); path_put(pathp);
return ret; return ret;
} }
SYSCALL_DEFINE4(quotactl_path, unsigned int, cmd, const char __user *,
mountpoint, qid_t, id, void __user *, addr)
{
struct super_block *sb;
struct path mountpath;
unsigned int cmds = cmd >> SUBCMDSHIFT;
unsigned int type = cmd & SUBCMDMASK;
int ret;
if (type >= MAXQUOTAS)
return -EINVAL;
ret = user_path_at(AT_FDCWD, mountpoint,
LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT, &mountpath);
if (ret)
return ret;
sb = mountpath.mnt->mnt_sb;
if (quotactl_cmd_write(cmds)) {
ret = mnt_want_write(mountpath.mnt);
if (ret)
goto out;
}
if (quotactl_cmd_onoff(cmds))
down_write(&sb->s_umount);
else
down_read(&sb->s_umount);
ret = do_quotactl(sb, type, cmds, id, addr, ERR_PTR(-EINVAL));
if (quotactl_cmd_onoff(cmds))
up_write(&sb->s_umount);
else
up_read(&sb->s_umount);
if (quotactl_cmd_write(cmds))
mnt_drop_write(mountpath.mnt);
out:
path_put(&mountpath);
return ret;
}
...@@ -461,7 +461,6 @@ int reiserfs_in_journal(struct super_block *sb, ...@@ -461,7 +461,6 @@ int reiserfs_in_journal(struct super_block *sb,
b_blocknr_t * next_zero_bit) b_blocknr_t * next_zero_bit)
{ {
struct reiserfs_journal *journal = SB_JOURNAL(sb); struct reiserfs_journal *journal = SB_JOURNAL(sb);
struct reiserfs_journal_cnode *cn;
struct reiserfs_list_bitmap *jb; struct reiserfs_list_bitmap *jb;
int i; int i;
unsigned long bl; unsigned long bl;
...@@ -497,13 +496,12 @@ int reiserfs_in_journal(struct super_block *sb, ...@@ -497,13 +496,12 @@ int reiserfs_in_journal(struct super_block *sb,
bl = bmap_nr * (sb->s_blocksize << 3) + bit_nr; bl = bmap_nr * (sb->s_blocksize << 3) + bit_nr;
/* is it in any old transactions? */ /* is it in any old transactions? */
if (search_all if (search_all
&& (cn = && (get_journal_hash_dev(sb, journal->j_list_hash_table, bl))) {
get_journal_hash_dev(sb, journal->j_list_hash_table, bl))) {
return 1; return 1;
} }
/* is it in the current transaction. This should never happen */ /* is it in the current transaction. This should never happen */
if ((cn = get_journal_hash_dev(sb, journal->j_hash_table, bl))) { if ((get_journal_hash_dev(sb, journal->j_hash_table, bl))) {
BUG(); BUG();
return 1; return 1;
} }
......
...@@ -483,6 +483,8 @@ asmlinkage long sys_pipe2(int __user *fildes, int flags); ...@@ -483,6 +483,8 @@ asmlinkage long sys_pipe2(int __user *fildes, int flags);
/* fs/quota.c */ /* fs/quota.c */
asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special, asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special,
qid_t id, void __user *addr); qid_t id, void __user *addr);
asmlinkage long sys_quotactl_path(unsigned int cmd, const char __user *mountpoint,
qid_t id, void __user *addr);
/* fs/readdir.c */ /* fs/readdir.c */
asmlinkage long sys_getdents64(unsigned int fd, asmlinkage long sys_getdents64(unsigned int fd,
......
...@@ -863,9 +863,11 @@ __SYSCALL(__NR_process_madvise, sys_process_madvise) ...@@ -863,9 +863,11 @@ __SYSCALL(__NR_process_madvise, sys_process_madvise)
__SC_COMP(__NR_epoll_pwait2, sys_epoll_pwait2, compat_sys_epoll_pwait2) __SC_COMP(__NR_epoll_pwait2, sys_epoll_pwait2, compat_sys_epoll_pwait2)
#define __NR_mount_setattr 442 #define __NR_mount_setattr 442
__SYSCALL(__NR_mount_setattr, sys_mount_setattr) __SYSCALL(__NR_mount_setattr, sys_mount_setattr)
#define __NR_quotactl_path 443
__SYSCALL(__NR_quotactl_path, sys_quotactl_path)
#undef __NR_syscalls #undef __NR_syscalls
#define __NR_syscalls 443 #define __NR_syscalls 444
/* /*
* 32 bit systems traditionally used different * 32 bit systems traditionally used different
......
...@@ -219,7 +219,10 @@ struct fs_quota_statv { ...@@ -219,7 +219,10 @@ struct fs_quota_statv {
__s32 qs_rtbtimelimit;/* limit for rt blks timer */ __s32 qs_rtbtimelimit;/* limit for rt blks timer */
__u16 qs_bwarnlimit; /* limit for num warnings */ __u16 qs_bwarnlimit; /* limit for num warnings */
__u16 qs_iwarnlimit; /* limit for num warnings */ __u16 qs_iwarnlimit; /* limit for num warnings */
__u64 qs_pad2[8]; /* for future proofing */ __u16 qs_rtbwarnlimit;/* limit for rt blks warnings */
__u16 qs_pad3;
__u32 qs_pad4;
__u64 qs_pad2[7]; /* for future proofing */
}; };
#endif /* _LINUX_DQBLK_XFS_H */ #endif /* _LINUX_DQBLK_XFS_H */
...@@ -99,6 +99,7 @@ COND_SYSCALL(flock); ...@@ -99,6 +99,7 @@ COND_SYSCALL(flock);
/* fs/quota.c */ /* fs/quota.c */
COND_SYSCALL(quotactl); COND_SYSCALL(quotactl);
COND_SYSCALL(quotactl_path);
/* fs/readdir.c */ /* fs/readdir.c */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment