Skip to content

Commit 09e70bb

Browse files
committed
Merge tag 'for_v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull ext2, udf, reiserfs, quota cleanups and minor fixes from Jan Kara: "A few ext2 fixups and then several (mostly comment and documentation) cleanups in ext2, udf, reiserfs, and quota" * tag 'for_v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: reiserfs: delete duplicated words udf: osta_udf.h: delete a duplicated word reiserfs: reiserfs.h: delete a duplicated word ext2: ext2.h: fix duplicated word + typos udf: Replace HTTP links with HTTPS ones quota: Fixup http links in quota doc Replace HTTP links with HTTPS ones: DISKQUOTA ext2: initialize quota info in ext2_xattr_set() ext2: fix some incorrect comments in inode.c ext2: remove nocheck option ext2: fix missing percpu_counter_inc ext2: ext2_find_entry() return -ENOENT if no entry found ext2: propagate errors up to ext2_find_entry()'s callers ext2: fix improper assignment for e_value_offs
2 parents 019c407 + 9436fb4 commit 09e70bb

File tree

18 files changed

+86
-84
lines changed

18 files changed

+86
-84
lines changed

Documentation/filesystems/quota.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Quota limits (and amount of grace time) are set independently for each
1818
filesystem.
1919

2020
For more details about quota design, see the documentation in quota-tools package
21-
(http://sourceforge.net/projects/linuxquota).
21+
(https://sourceforge.net/projects/linuxquota).
2222

2323
Quota netlink interface
2424
=======================
@@ -31,11 +31,11 @@ the above events to userspace. There they can be captured by an application
3131
and processed accordingly.
3232

3333
The interface uses generic netlink framework (see
34-
http://lwn.net/Articles/208755/ and http://people.suug.ch/~tgr/libnl/ for more
35-
details about this layer). The name of the quota generic netlink interface
36-
is "VFS_DQUOT". Definitions of constants below are in <linux/quota.h>.
37-
Since the quota netlink protocol is not namespace aware, quota netlink messages
38-
are sent only in initial network namespace.
34+
https://lwn.net/Articles/208755/ and http://www.infradead.org/~tgr/libnl/ for
35+
more details about this layer). The name of the quota generic netlink interface
36+
is "VFS_DQUOT". Definitions of constants below are in <linux/quota.h>. Since
37+
the quota netlink protocol is not namespace aware, quota netlink messages are
38+
sent only in initial network namespace.
3939

4040
Currently, the interface supports only one message type QUOTA_NL_C_WARNING.
4141
This command is used to send a notification about any of the above mentioned

Documentation/filesystems/udf.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ For the latest version and toolset see:
7272

7373
Documentation on UDF and ECMA 167 is available FREE from:
7474
- http://www.osta.org/
75-
- http://www.ecma-international.org/
75+
- https://www.ecma-international.org/

fs/ext2/dir.c

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir,
348348
struct page *page = NULL;
349349
struct ext2_inode_info *ei = EXT2_I(dir);
350350
ext2_dirent * de;
351-
int dir_has_error = 0;
352351

353352
if (npages == 0)
354353
goto out;
@@ -362,25 +361,25 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir,
362361
n = start;
363362
do {
364363
char *kaddr;
365-
page = ext2_get_page(dir, n, dir_has_error);
366-
if (!IS_ERR(page)) {
367-
kaddr = page_address(page);
368-
de = (ext2_dirent *) kaddr;
369-
kaddr += ext2_last_byte(dir, n) - reclen;
370-
while ((char *) de <= kaddr) {
371-
if (de->rec_len == 0) {
372-
ext2_error(dir->i_sb, __func__,
373-
"zero-length directory entry");
374-
ext2_put_page(page);
375-
goto out;
376-
}
377-
if (ext2_match (namelen, name, de))
378-
goto found;
379-
de = ext2_next_entry(de);
364+
page = ext2_get_page(dir, n, 0);
365+
if (IS_ERR(page))
366+
return ERR_CAST(page);
367+
368+
kaddr = page_address(page);
369+
de = (ext2_dirent *) kaddr;
370+
kaddr += ext2_last_byte(dir, n) - reclen;
371+
while ((char *) de <= kaddr) {
372+
if (de->rec_len == 0) {
373+
ext2_error(dir->i_sb, __func__,
374+
"zero-length directory entry");
375+
ext2_put_page(page);
376+
goto out;
380377
}
381-
ext2_put_page(page);
382-
} else
383-
dir_has_error = 1;
378+
if (ext2_match(namelen, name, de))
379+
goto found;
380+
de = ext2_next_entry(de);
381+
}
382+
ext2_put_page(page);
384383

385384
if (++n >= npages)
386385
n = 0;
@@ -394,7 +393,7 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir,
394393
}
395394
} while (n != start);
396395
out:
397-
return NULL;
396+
return ERR_PTR(-ENOENT);
398397

399398
found:
400399
*res_page = page;
@@ -414,18 +413,18 @@ struct ext2_dir_entry_2 * ext2_dotdot (struct inode *dir, struct page **p)
414413
return de;
415414
}
416415

417-
ino_t ext2_inode_by_name(struct inode *dir, const struct qstr *child)
416+
int ext2_inode_by_name(struct inode *dir, const struct qstr *child, ino_t *ino)
418417
{
419-
ino_t res = 0;
420418
struct ext2_dir_entry_2 *de;
421419
struct page *page;
422420

423-
de = ext2_find_entry (dir, child, &page);
424-
if (de) {
425-
res = le32_to_cpu(de->inode);
426-
ext2_put_page(page);
427-
}
428-
return res;
421+
de = ext2_find_entry(dir, child, &page);
422+
if (IS_ERR(de))
423+
return PTR_ERR(de);
424+
425+
*ino = le32_to_cpu(de->inode);
426+
ext2_put_page(page);
427+
return 0;
429428
}
430429

431430
static int ext2_prepare_chunk(struct page *page, loff_t pos, unsigned len)

fs/ext2/ext2.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ struct ext2_block_alloc_info {
5252
/*
5353
* Was i_next_alloc_goal in ext2_inode_info
5454
* is the *physical* companion to i_next_alloc_block.
55-
* it the the physical block number of the block which was most-recentl
56-
* allocated to this file. This give us the goal (target) for the next
55+
* it is the physical block number of the block which was most-recently
56+
* allocated to this file. This gives us the goal (target) for the next
5757
* allocation when we detect linearly ascending requests.
5858
*/
5959
ext2_fsblk_t last_alloc_physical_block;
@@ -374,7 +374,6 @@ struct ext2_inode {
374374
/*
375375
* Mount flags
376376
*/
377-
#define EXT2_MOUNT_CHECK 0x000001 /* Do mount-time checks */
378377
#define EXT2_MOUNT_OLDALLOC 0x000002 /* Don't use the new Orlov allocator */
379378
#define EXT2_MOUNT_GRPID 0x000004 /* Create files with directory's group */
380379
#define EXT2_MOUNT_DEBUG 0x000008 /* Some debugging messages */
@@ -738,7 +737,8 @@ extern void ext2_rsv_window_add(struct super_block *sb, struct ext2_reserve_wind
738737

739738
/* dir.c */
740739
extern int ext2_add_link (struct dentry *, struct inode *);
741-
extern ino_t ext2_inode_by_name(struct inode *, const struct qstr *);
740+
extern int ext2_inode_by_name(struct inode *dir,
741+
const struct qstr *child, ino_t *ino);
742742
extern int ext2_make_empty(struct inode *, struct inode *);
743743
extern struct ext2_dir_entry_2 * ext2_find_entry (struct inode *,const struct qstr *, struct page **);
744744
extern int ext2_delete_entry (struct ext2_dir_entry_2 *, struct page *);

fs/ext2/ialloc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ static void ext2_release_inode(struct super_block *sb, int group, int dir)
8080
if (dir)
8181
le16_add_cpu(&desc->bg_used_dirs_count, -1);
8282
spin_unlock(sb_bgl_lock(EXT2_SB(sb), group));
83+
percpu_counter_inc(&EXT2_SB(sb)->s_freeinodes_counter);
8384
if (dir)
8485
percpu_counter_dec(&EXT2_SB(sb)->s_dirs_counter);
8586
mark_buffer_dirty(bh);
@@ -528,7 +529,7 @@ struct inode *ext2_new_inode(struct inode *dir, umode_t mode,
528529
goto fail;
529530
}
530531

531-
percpu_counter_add(&sbi->s_freeinodes_counter, -1);
532+
percpu_counter_dec(&sbi->s_freeinodes_counter);
532533
if (S_ISDIR(mode))
533534
percpu_counter_inc(&sbi->s_dirs_counter);
534535

fs/ext2/inode.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,7 @@ static inline ext2_fsblk_t ext2_find_goal(struct inode *inode, long block,
356356
* @blks: number of data blocks to be mapped.
357357
* @blocks_to_boundary: the offset in the indirect block
358358
*
359-
* return the total number of blocks to be allocate, including the
360-
* direct and indirect blocks.
359+
* return the number of direct blocks to allocate.
361360
*/
362361
static int
363362
ext2_blks_to_allocate(Indirect * branch, int k, unsigned long blks,
@@ -390,11 +389,9 @@ ext2_blks_to_allocate(Indirect * branch, int k, unsigned long blks,
390389
* ext2_alloc_blocks: multiple allocate blocks needed for a branch
391390
* @indirect_blks: the number of blocks need to allocate for indirect
392391
* blocks
393-
*
392+
* @blks: the number of blocks need to allocate for direct blocks
394393
* @new_blocks: on return it will store the new block numbers for
395394
* the indirect blocks(if needed) and the first direct block,
396-
* @blks: on return it will store the total number of allocated
397-
* direct blocks
398395
*/
399396
static int ext2_alloc_blocks(struct inode *inode,
400397
ext2_fsblk_t goal, int indirect_blks, int blks,

fs/ext2/namei.c

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,17 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, uns
5757
{
5858
struct inode * inode;
5959
ino_t ino;
60+
int res;
6061

6162
if (dentry->d_name.len > EXT2_NAME_LEN)
6263
return ERR_PTR(-ENAMETOOLONG);
6364

64-
ino = ext2_inode_by_name(dir, &dentry->d_name);
65-
inode = NULL;
66-
if (ino) {
65+
res = ext2_inode_by_name(dir, &dentry->d_name, &ino);
66+
if (res) {
67+
if (res != -ENOENT)
68+
return ERR_PTR(res);
69+
inode = NULL;
70+
} else {
6771
inode = ext2_iget(dir->i_sb, ino);
6872
if (inode == ERR_PTR(-ESTALE)) {
6973
ext2_error(dir->i_sb, __func__,
@@ -78,9 +82,13 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, uns
7882
struct dentry *ext2_get_parent(struct dentry *child)
7983
{
8084
struct qstr dotdot = QSTR_INIT("..", 2);
81-
unsigned long ino = ext2_inode_by_name(d_inode(child), &dotdot);
82-
if (!ino)
83-
return ERR_PTR(-ENOENT);
85+
ino_t ino;
86+
int res;
87+
88+
res = ext2_inode_by_name(d_inode(child), &dotdot, &ino);
89+
if (res)
90+
return ERR_PTR(res);
91+
8492
return d_obtain_alias(ext2_iget(child->d_sb, ino));
8593
}
8694

@@ -274,9 +282,9 @@ static int ext2_unlink(struct inode * dir, struct dentry *dentry)
274282
if (err)
275283
goto out;
276284

277-
de = ext2_find_entry (dir, &dentry->d_name, &page);
278-
if (!de) {
279-
err = -ENOENT;
285+
de = ext2_find_entry(dir, &dentry->d_name, &page);
286+
if (IS_ERR(de)) {
287+
err = PTR_ERR(de);
280288
goto out;
281289
}
282290

@@ -330,9 +338,9 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
330338
if (err)
331339
goto out;
332340

333-
old_de = ext2_find_entry (old_dir, &old_dentry->d_name, &old_page);
334-
if (!old_de) {
335-
err = -ENOENT;
341+
old_de = ext2_find_entry(old_dir, &old_dentry->d_name, &old_page);
342+
if (IS_ERR(old_de)) {
343+
err = PTR_ERR(old_de);
336344
goto out;
337345
}
338346

@@ -351,10 +359,11 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
351359
if (dir_de && !ext2_empty_dir (new_inode))
352360
goto out_dir;
353361

354-
err = -ENOENT;
355-
new_de = ext2_find_entry (new_dir, &new_dentry->d_name, &new_page);
356-
if (!new_de)
362+
new_de = ext2_find_entry(new_dir, &new_dentry->d_name, &new_page);
363+
if (IS_ERR(new_de)) {
364+
err = PTR_ERR(new_de);
357365
goto out_dir;
366+
}
358367
ext2_set_link(new_dir, new_de, new_page, old_inode, 1);
359368
new_inode->i_ctime = current_time(new_inode);
360369
if (dir_de)

fs/ext2/super.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ static unsigned long get_sb_block(void **data)
431431
enum {
432432
Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid,
433433
Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic,
434-
Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug,
434+
Opt_err_ro, Opt_nouid32, Opt_debug,
435435
Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr,
436436
Opt_acl, Opt_noacl, Opt_xip, Opt_dax, Opt_ignore, Opt_err, Opt_quota,
437437
Opt_usrquota, Opt_grpquota, Opt_reservation, Opt_noreservation
@@ -451,8 +451,6 @@ static const match_table_t tokens = {
451451
{Opt_err_panic, "errors=panic"},
452452
{Opt_err_ro, "errors=remount-ro"},
453453
{Opt_nouid32, "nouid32"},
454-
{Opt_nocheck, "check=none"},
455-
{Opt_nocheck, "nocheck"},
456454
{Opt_debug, "debug"},
457455
{Opt_oldalloc, "oldalloc"},
458456
{Opt_orlov, "orlov"},
@@ -546,12 +544,6 @@ static int parse_options(char *options, struct super_block *sb,
546544
case Opt_nouid32:
547545
set_opt (opts->s_mount_opt, NO_UID32);
548546
break;
549-
case Opt_nocheck:
550-
ext2_msg(sb, KERN_WARNING,
551-
"Option nocheck/check=none is deprecated and"
552-
" will be removed in June 2020.");
553-
clear_opt (opts->s_mount_opt, CHECK);
554-
break;
555547
case Opt_debug:
556548
set_opt (opts->s_mount_opt, DEBUG);
557549
break;

fs/ext2/xattr.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,9 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
437437
name_len = strlen(name);
438438
if (name_len > 255 || value_len > sb->s_blocksize)
439439
return -ERANGE;
440+
error = dquot_initialize(inode);
441+
if (error)
442+
return error;
440443
down_write(&EXT2_I(inode)->xattr_sem);
441444
if (EXT2_I(inode)->i_file_acl) {
442445
/* The inode already has an extended attribute block. */
@@ -588,7 +591,6 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
588591
/* Remove the old value. */
589592
memmove(first_val + size, first_val, val - first_val);
590593
memset(first_val, 0, size);
591-
here->e_value_offs = 0;
592594
min_offs += size;
593595

594596
/* Adjust all value offsets. */
@@ -600,6 +602,8 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
600602
cpu_to_le16(o + size);
601603
last = EXT2_XATTR_NEXT(last);
602604
}
605+
606+
here->e_value_offs = 0;
603607
}
604608
if (value == NULL) {
605609
/* Remove the old name. */

fs/quota/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ config QUOTA
1515
Ext3, ext4 and reiserfs also support journaled quotas for which
1616
you don't need to run quotacheck(8) after an unclean shutdown.
1717
For further details, read the Quota mini-HOWTO, available from
18-
<http://www.tldp.org/docs.html#howto>, or the documentation provided
18+
<https://www.tldp.org/docs.html#howto>, or the documentation provided
1919
with the quota tools. Probably the quota support is only useful for
2020
multi user systems. If unsure, say N.
2121

0 commit comments

Comments
 (0)