Skip to content

Commit

Permalink
Merge tag 'for_v5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/jack/linux-fs

Pull UDF, quota, reiserfs, ext2 fixes and cleanups from Jan Kara:
 "A few assorted fixes and cleanups for udf, quota, reiserfs, and ext2"

* tag 'for_v5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  fs/reiserfs: remove unused macros
  fs/quota: remove unused macro
  udf: Clarify meaning of f_files in udf_statfs
  udf: Allow writing to 'Rewritable' partitions
  udf: Disallow R/W mode for disk with Metadata partition
  udf: Fix meaning of ENTITYID_FLAGS_* macros to be really bitwise-or flags
  udf: Fix free space reporting for metadata and virtual partitions
  udf: Update header files to UDF 2.60
  udf: Move OSTA Identifier Suffix macros from ecma_167.h to osta_udf.h
  udf: Fix spelling in EXT_NEXT_EXTENT_ALLOCDESCS
  ext2: Adjust indentation in ext2_fill_super
  quota: avoid time_t in v1_disk_dqblk definition
  reiserfs: Fix spurious unlock in reiserfs_fill_super() error handling
  reiserfs: Fix memory leak of journal device string
  ext2: set proper errno in error case of ext2_fill_super()
  • Loading branch information
Linus Torvalds committed Jan 30, 2020
2 parents 91f1a95 + 154a4dc commit 0196be1
Show file tree
Hide file tree
Showing 12 changed files with 137 additions and 85 deletions.
7 changes: 4 additions & 3 deletions fs/ext2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1073,9 +1073,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)

if (EXT2_BLOCKS_PER_GROUP(sb) == 0)
goto cantfind_ext2;
sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) -
le32_to_cpu(es->s_first_data_block) - 1)
/ EXT2_BLOCKS_PER_GROUP(sb)) + 1;
sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) -
le32_to_cpu(es->s_first_data_block) - 1)
/ EXT2_BLOCKS_PER_GROUP(sb)) + 1;
db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) /
EXT2_DESC_PER_BLOCK(sb);
sbi->s_group_desc = kmalloc_array (db_count,
Expand Down Expand Up @@ -1138,6 +1138,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
ext2_count_dirs(sb), GFP_KERNEL);
}
if (err) {
ret = err;
ext2_msg(sb, KERN_ERR, "error: insufficient memory");
goto failed_mount3;
}
Expand Down
2 changes: 0 additions & 2 deletions fs/quota/quota_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ MODULE_AUTHOR("Jan Kara");
MODULE_DESCRIPTION("Quota format v2 support");
MODULE_LICENSE("GPL");

#define __QUOTA_V2_PARANOIA

static void v2r0_mem2diskdqb(void *dp, struct dquot *dquot);
static void v2r0_disk2memdqb(struct dquot *dquot, void *dp);
static int v2r0_is_id(void *dp, struct dquot *dquot);
Expand Down
6 changes: 4 additions & 2 deletions fs/quota/quotaio_v1.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ struct v1_disk_dqblk {
__u32 dqb_ihardlimit; /* absolute limit on allocated inodes */
__u32 dqb_isoftlimit; /* preferred inode limit */
__u32 dqb_curinodes; /* current # allocated inodes */
time_t dqb_btime; /* time limit for excessive disk use */
time_t dqb_itime; /* time limit for excessive inode use */

/* below fields differ in length on 32-bit vs 64-bit architectures */
unsigned long dqb_btime; /* time limit for excessive disk use */
unsigned long dqb_itime; /* time limit for excessive inode use */
};

#define v1_dqoff(UID) ((loff_t)((UID) * sizeof (struct v1_disk_dqblk)))
Expand Down
2 changes: 0 additions & 2 deletions fs/reiserfs/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
/* gets a struct reiserfs_journal_list * from a list head */
#define JOURNAL_LIST_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \
j_list))
#define JOURNAL_WORK_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \
j_working_list))

/* must be correct to keep the desc and commit structs at 4k */
#define JOURNAL_TRANS_HALF 1018
Expand Down
1 change: 0 additions & 1 deletion fs/reiserfs/procfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ static int show_version(struct seq_file *m, void *unused)
#define MAP( i ) D4C( objectid_map( sb, rs )[ i ] )

#define DJF( x ) le32_to_cpu( rs -> x )
#define DJV( x ) le32_to_cpu( s_v1 -> x )
#define DJP( x ) le32_to_cpu( jp -> x )
#define JF( x ) ( r -> s_journal -> x )

Expand Down
6 changes: 0 additions & 6 deletions fs/reiserfs/stree.c
Original file line number Diff line number Diff line change
Expand Up @@ -918,12 +918,6 @@ int comp_items(const struct item_head *stored_ih, const struct treepath *path)
return memcmp(stored_ih, ih, IH_SIZE);
}

/* unformatted nodes are not logged anymore, ever. This is safe now */
#define held_by_others(bh) (atomic_read(&(bh)->b_count) > 1)

/* block can not be forgotten as it is in I/O or held by someone */
#define block_in_use(bh) (buffer_locked(bh) || (held_by_others(bh)))

/* prepare for delete or cut of direct item */
static inline int prepare_for_direct_item(struct treepath *path,
struct item_head *le_ih,
Expand Down
4 changes: 3 additions & 1 deletion fs/reiserfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ static void reiserfs_put_super(struct super_block *s)
reiserfs_write_unlock(s);
mutex_destroy(&REISERFS_SB(s)->lock);
destroy_workqueue(REISERFS_SB(s)->commit_wq);
kfree(REISERFS_SB(s)->s_jdev);
kfree(s->s_fs_info);
s->s_fs_info = NULL;
}
Expand Down Expand Up @@ -1947,7 +1948,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
if (!sbi->s_jdev) {
SWARN(silent, s, "", "Cannot allocate memory for "
"journal device name");
goto error;
goto error_unlocked;
}
}
#ifdef CONFIG_QUOTA
Expand Down Expand Up @@ -2240,6 +2241,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
kfree(qf_names[j]);
}
#endif
kfree(sbi->s_jdev);
kfree(sbi);

s->s_fs_info = NULL;
Expand Down
46 changes: 26 additions & 20 deletions fs/udf/ecma_167.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* This file is based on ECMA-167 3rd edition (June 1997)
* http://www.ecma.ch
*
* Copyright (c) 2001-2002 Ben Fennema <bfennema@falcon.csc.calpoly.edu>
* Copyright (c) 2001-2002 Ben Fennema
* Copyright (c) 2017-2019 Pali Rohár <pali.rohar@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -32,11 +33,19 @@
* SUCH DAMAGE.
*/

/**
* @file
* ECMA-167r3 defines and structure definitions
*/

#include <linux/types.h>

#ifndef _ECMA_167_H
#define _ECMA_167_H 1

/* Character sets and coding - d-characters (ECMA 167r3 1/7.2) */
typedef uint8_t dchars;

/* Character set specification (ECMA 167r3 1/7.2.1) */
struct charspec {
uint8_t charSetType;
Expand All @@ -54,6 +63,7 @@ struct charspec {
#define CHARSPEC_TYPE_CS7 0x07 /* (1/7.2.9) */
#define CHARSPEC_TYPE_CS8 0x08 /* (1/7.2.10) */

/* Fixed-length character fields - d-string (EMCA 167r3 1/7.2.12) */
typedef uint8_t dstring;

/* Timestamp (ECMA 167r3 1/7.3) */
Expand Down Expand Up @@ -85,22 +95,8 @@ struct regid {
} __packed;

/* Flags (ECMA 167r3 1/7.4.1) */
#define ENTITYID_FLAGS_DIRTY 0x00
#define ENTITYID_FLAGS_PROTECTED 0x01

/* OSTA UDF 2.1.5.2 */
#define UDF_ID_COMPLIANT "*OSTA UDF Compliant"

/* OSTA UDF 2.1.5.3 */
struct domainEntityIDSuffix {
uint16_t revision;
uint8_t flags;
uint8_t reserved[5];
};

/* OSTA UDF 2.1.5.3 */
#define ENTITYIDSUFFIX_FLAGS_HARDWRITEPROTECT 0
#define ENTITYIDSUFFIX_FLAGS_SOFTWRITEPROTECT 1
#define ENTITYID_FLAGS_DIRTY 0x01
#define ENTITYID_FLAGS_PROTECTED 0x02

/* Volume Structure Descriptor (ECMA 167r3 2/9.1) */
#define VSD_STD_ID_LEN 5
Expand Down Expand Up @@ -202,6 +198,13 @@ struct NSRDesc {
uint8_t structData[2040];
} __packed;

/* Generic Descriptor */
struct genericDesc {
struct tag descTag;
__le32 volDescSeqNum;
uint8_t reserved[492];
} __packed;

/* Primary Volume Descriptor (ECMA 167r3 3/10.1) */
struct primaryVolDesc {
struct tag descTag;
Expand Down Expand Up @@ -316,7 +319,7 @@ struct genericPartitionMap {

/* Partition Map Type (ECMA 167r3 3/10.7.1.1) */
#define GP_PARTITION_MAP_TYPE_UNDEF 0x00
#define GP_PARTIITON_MAP_TYPE_1 0x01
#define GP_PARTITION_MAP_TYPE_1 0x01
#define GP_PARTITION_MAP_TYPE_2 0x02

/* Type 1 Partition Map (ECMA 167r3 3/10.7.2) */
Expand Down Expand Up @@ -723,6 +726,7 @@ struct appUseExtAttr {
#define EXTATTR_DEV_SPEC 12
#define EXTATTR_IMP_USE 2048
#define EXTATTR_APP_USE 65536
#define EXTATTR_SUBTYPE 1

/* Unallocated Space Entry (ECMA 167r3 4/14.11) */
struct unallocSpaceEntry {
Expand Down Expand Up @@ -754,10 +758,12 @@ struct partitionIntegrityEntry {
/* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */

/* Extent Length (ECMA 167r3 4/14.14.1.1) */
#define EXT_LENGTH_MASK 0x3FFFFFFF
#define EXT_TYPE_MASK 0xC0000000
#define EXT_RECORDED_ALLOCATED 0x00000000
#define EXT_NOT_RECORDED_ALLOCATED 0x40000000
#define EXT_NOT_RECORDED_NOT_ALLOCATED 0x80000000
#define EXT_NEXT_EXTENT_ALLOCDECS 0xC0000000
#define EXT_NEXT_EXTENT_ALLOCDESCS 0xC0000000

/* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */

Expand All @@ -774,7 +780,7 @@ struct pathComponent {
uint8_t componentType;
uint8_t lengthComponentIdent;
__le16 componentFileVersionNum;
dstring componentIdent[0];
dchars componentIdent[0];
} __packed;

/* File Entry (ECMA 167r3 4/14.17) */
Expand Down
6 changes: 3 additions & 3 deletions fs/udf/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1981,10 +1981,10 @@ int udf_setup_indirect_aext(struct inode *inode, udf_pblk_t block,

__udf_add_aext(inode, &nepos, &cp_loc, cp_len, 1);
udf_write_aext(inode, epos, &nepos.block,
sb->s_blocksize | EXT_NEXT_EXTENT_ALLOCDECS, 0);
sb->s_blocksize | EXT_NEXT_EXTENT_ALLOCDESCS, 0);
} else {
__udf_add_aext(inode, epos, &nepos.block,
sb->s_blocksize | EXT_NEXT_EXTENT_ALLOCDECS, 0);
sb->s_blocksize | EXT_NEXT_EXTENT_ALLOCDESCS, 0);
}

brelse(epos->bh);
Expand Down Expand Up @@ -2143,7 +2143,7 @@ int8_t udf_next_aext(struct inode *inode, struct extent_position *epos,
unsigned int indirections = 0;

while ((etype = udf_current_aext(inode, epos, eloc, elen, inc)) ==
(EXT_NEXT_EXTENT_ALLOCDECS >> 30)) {
(EXT_NEXT_EXTENT_ALLOCDESCS >> 30)) {
udf_pblk_t block;

if (++indirections > UDF_MAX_INDIR_EXTS) {
Expand Down
Loading

0 comments on commit 0196be1

Please sign in to comment.