Commit 56c003e4 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'jfs-6.2' of https://github.com/kleikamp/linux-shaggy

Pull jfs updates from David Kleikamp:
 "Assorted JFS fixes for 6.2"

* tag 'jfs-6.2' of https://github.com/kleikamp/linux-shaggy:
  jfs: makes diUnmount/diMount in jfs_mount_rw atomic
  jfs: Fix a typo in function jfs_umount
  fs: jfs: fix shift-out-of-bounds in dbDiscardAG
  jfs: Fix fortify moan in symlink
  jfs: remove redundant assignments to ipaimap and ipaimap2
  jfs: remove unused declarations for jfs
  fs/jfs/jfs_xattr.h: Fix spelling typo in comment
  MAINTAINERS: git://github -> https://github.com for kleikamp
  fs/jfs: replace ternary operator with min_t()
  fs: jfs: fix shift-out-of-bounds in dbAllocAG
parents cda6a60a a60dca73
...@@ -10993,9 +10993,9 @@ F: drivers/hwmon/jc42.c ...@@ -10993,9 +10993,9 @@ F: drivers/hwmon/jc42.c
JFS FILESYSTEM JFS FILESYSTEM
M: Dave Kleikamp <shaggy@kernel.org> M: Dave Kleikamp <shaggy@kernel.org>
L: jfs-discussion@lists.sourceforge.net L: jfs-discussion@lists.sourceforge.net
S: Maintained S: Odd Fixes
W: http://jfs.sourceforge.net/ W: http://jfs.sourceforge.net/
T: git git://github.com/kleikamp/linux-shaggy.git T: git https://github.com/kleikamp/linux-shaggy.git
F: Documentation/admin-guide/jfs.rst F: Documentation/admin-guide/jfs.rst
F: fs/jfs/ F: fs/jfs/
......
...@@ -155,7 +155,7 @@ int dbMount(struct inode *ipbmap) ...@@ -155,7 +155,7 @@ int dbMount(struct inode *ipbmap)
struct bmap *bmp; struct bmap *bmp;
struct dbmap_disk *dbmp_le; struct dbmap_disk *dbmp_le;
struct metapage *mp; struct metapage *mp;
int i; int i, err;
/* /*
* allocate/initialize the in-memory bmap descriptor * allocate/initialize the in-memory bmap descriptor
...@@ -170,8 +170,8 @@ int dbMount(struct inode *ipbmap) ...@@ -170,8 +170,8 @@ int dbMount(struct inode *ipbmap)
BMAPBLKNO << JFS_SBI(ipbmap->i_sb)->l2nbperpage, BMAPBLKNO << JFS_SBI(ipbmap->i_sb)->l2nbperpage,
PSIZE, 0); PSIZE, 0);
if (mp == NULL) { if (mp == NULL) {
kfree(bmp); err = -EIO;
return -EIO; goto err_kfree_bmp;
} }
/* copy the on-disk bmap descriptor to its in-memory version. */ /* copy the on-disk bmap descriptor to its in-memory version. */
...@@ -181,9 +181,8 @@ int dbMount(struct inode *ipbmap) ...@@ -181,9 +181,8 @@ int dbMount(struct inode *ipbmap)
bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage); bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage);
bmp->db_numag = le32_to_cpu(dbmp_le->dn_numag); bmp->db_numag = le32_to_cpu(dbmp_le->dn_numag);
if (!bmp->db_numag) { if (!bmp->db_numag) {
release_metapage(mp); err = -EINVAL;
kfree(bmp); goto err_release_metapage;
return -EINVAL;
} }
bmp->db_maxlevel = le32_to_cpu(dbmp_le->dn_maxlevel); bmp->db_maxlevel = le32_to_cpu(dbmp_le->dn_maxlevel);
...@@ -194,6 +193,16 @@ int dbMount(struct inode *ipbmap) ...@@ -194,6 +193,16 @@ int dbMount(struct inode *ipbmap)
bmp->db_agwidth = le32_to_cpu(dbmp_le->dn_agwidth); bmp->db_agwidth = le32_to_cpu(dbmp_le->dn_agwidth);
bmp->db_agstart = le32_to_cpu(dbmp_le->dn_agstart); bmp->db_agstart = le32_to_cpu(dbmp_le->dn_agstart);
bmp->db_agl2size = le32_to_cpu(dbmp_le->dn_agl2size); bmp->db_agl2size = le32_to_cpu(dbmp_le->dn_agl2size);
if (bmp->db_agl2size > L2MAXL2SIZE - L2MAXAG) {
err = -EINVAL;
goto err_release_metapage;
}
if (((bmp->db_mapsize - 1) >> bmp->db_agl2size) > MAXAG) {
err = -EINVAL;
goto err_release_metapage;
}
for (i = 0; i < MAXAG; i++) for (i = 0; i < MAXAG; i++)
bmp->db_agfree[i] = le64_to_cpu(dbmp_le->dn_agfree[i]); bmp->db_agfree[i] = le64_to_cpu(dbmp_le->dn_agfree[i]);
bmp->db_agsize = le64_to_cpu(dbmp_le->dn_agsize); bmp->db_agsize = le64_to_cpu(dbmp_le->dn_agsize);
...@@ -214,6 +223,12 @@ int dbMount(struct inode *ipbmap) ...@@ -214,6 +223,12 @@ int dbMount(struct inode *ipbmap)
BMAP_LOCK_INIT(bmp); BMAP_LOCK_INIT(bmp);
return (0); return (0);
err_release_metapage:
release_metapage(mp);
err_kfree_bmp:
kfree(bmp);
return err;
} }
......
...@@ -10,9 +10,7 @@ ...@@ -10,9 +10,7 @@
(addressPXD(&(JFS_IP(ip)->ixpxd)) + lengthPXD(&(JFS_IP(ip)->ixpxd)) - 1) (addressPXD(&(JFS_IP(ip)->ixpxd)) + lengthPXD(&(JFS_IP(ip)->ixpxd)) - 1)
extern int extAlloc(struct inode *, s64, s64, xad_t *, bool); extern int extAlloc(struct inode *, s64, s64, xad_t *, bool);
extern int extFill(struct inode *, xad_t *);
extern int extHint(struct inode *, s64, xad_t *); extern int extHint(struct inode *, s64, xad_t *);
extern int extRealloc(struct inode *, s64, xad_t *, bool);
extern int extRecord(struct inode *, xad_t *); extern int extRecord(struct inode *, xad_t *);
#endif /* _H_JFS_EXTENT */ #endif /* _H_JFS_EXTENT */
...@@ -310,8 +310,8 @@ int diRead(struct inode *ip) ...@@ -310,8 +310,8 @@ int diRead(struct inode *ip)
iagno = INOTOIAG(ip->i_ino); iagno = INOTOIAG(ip->i_ino);
/* read the iag */ /* read the iag */
imap = JFS_IP(ipimap)->i_imap;
IREAD_LOCK(ipimap, RDWRLOCK_IMAP); IREAD_LOCK(ipimap, RDWRLOCK_IMAP);
imap = JFS_IP(ipimap)->i_imap;
rc = diIAGRead(imap, iagno, &mp); rc = diIAGRead(imap, iagno, &mp);
IREAD_UNLOCK(ipimap); IREAD_UNLOCK(ipimap);
if (rc) { if (rc) {
......
...@@ -234,11 +234,15 @@ int jfs_mount_rw(struct super_block *sb, int remount) ...@@ -234,11 +234,15 @@ int jfs_mount_rw(struct super_block *sb, int remount)
truncate_inode_pages(sbi->ipimap->i_mapping, 0); truncate_inode_pages(sbi->ipimap->i_mapping, 0);
truncate_inode_pages(sbi->ipbmap->i_mapping, 0); truncate_inode_pages(sbi->ipbmap->i_mapping, 0);
IWRITE_LOCK(sbi->ipimap, RDWRLOCK_IMAP);
diUnmount(sbi->ipimap, 1); diUnmount(sbi->ipimap, 1);
if ((rc = diMount(sbi->ipimap))) { if ((rc = diMount(sbi->ipimap))) {
IWRITE_UNLOCK(sbi->ipimap);
jfs_err("jfs_mount_rw: diMount failed!"); jfs_err("jfs_mount_rw: diMount failed!");
return rc; return rc;
} }
IWRITE_UNLOCK(sbi->ipimap);
dbUnmount(sbi->ipbmap, 1); dbUnmount(sbi->ipbmap, 1);
if ((rc = dbMount(sbi->ipbmap))) { if ((rc = dbMount(sbi->ipbmap))) {
......
...@@ -68,7 +68,6 @@ int jfs_umount(struct super_block *sb) ...@@ -68,7 +68,6 @@ int jfs_umount(struct super_block *sb)
/* /*
* close secondary aggregate inode allocation map * close secondary aggregate inode allocation map
*/ */
ipaimap2 = sbi->ipaimap2;
if (ipaimap2) { if (ipaimap2) {
diUnmount(ipaimap2, 0); diUnmount(ipaimap2, 0);
diFreeSpecial(ipaimap2); diFreeSpecial(ipaimap2);
...@@ -78,7 +77,6 @@ int jfs_umount(struct super_block *sb) ...@@ -78,7 +77,6 @@ int jfs_umount(struct super_block *sb)
/* /*
* close aggregate inode allocation map * close aggregate inode allocation map
*/ */
ipaimap = sbi->ipaimap;
diUnmount(ipaimap, 0); diUnmount(ipaimap, 0);
diFreeSpecial(ipaimap); diFreeSpecial(ipaimap);
sbi->ipaimap = NULL; sbi->ipaimap = NULL;
...@@ -89,7 +87,7 @@ int jfs_umount(struct super_block *sb) ...@@ -89,7 +87,7 @@ int jfs_umount(struct super_block *sb)
dbUnmount(ipbmap, 0); dbUnmount(ipbmap, 0);
diFreeSpecial(ipbmap); diFreeSpecial(ipbmap);
sbi->ipimap = NULL; sbi->ipbmap = NULL;
/* /*
* Make sure all metadata makes it to disk before we mark * Make sure all metadata makes it to disk before we mark
......
...@@ -25,7 +25,7 @@ struct jfs_ea_list { ...@@ -25,7 +25,7 @@ struct jfs_ea_list {
struct jfs_ea ea[]; /* Variable length list */ struct jfs_ea ea[]; /* Variable length list */
}; };
/* Macros for defining maxiumum number of bytes supported for EAs */ /* Macros for defining maximum number of bytes supported for EAs */
#define MAXEASIZE 65535 #define MAXEASIZE 65535
#define MAXEALISTSIZE MAXEASIZE #define MAXEALISTSIZE MAXEASIZE
......
...@@ -96,12 +96,8 @@ extern int xtInsert(tid_t tid, struct inode *ip, ...@@ -96,12 +96,8 @@ extern int xtInsert(tid_t tid, struct inode *ip,
extern int xtExtend(tid_t tid, struct inode *ip, s64 xoff, int xlen, extern int xtExtend(tid_t tid, struct inode *ip, s64 xoff, int xlen,
int flag); int flag);
extern int xtUpdate(tid_t tid, struct inode *ip, struct xad *nxad); extern int xtUpdate(tid_t tid, struct inode *ip, struct xad *nxad);
extern int xtDelete(tid_t tid, struct inode *ip, s64 xoff, int xlen,
int flag);
extern s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int type); extern s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int type);
extern s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size); extern s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size);
extern int xtRelocate(tid_t tid, struct inode *ip,
xad_t * oxad, s64 nxaddr, int xtype);
extern int xtAppend(tid_t tid, extern int xtAppend(tid_t tid,
struct inode *ip, int xflag, s64 xoff, int maxblocks, struct inode *ip, int xflag, s64 xoff, int maxblocks,
int *xlenp, s64 * xaddrp, int flag); int *xlenp, s64 * xaddrp, int flag);
......
...@@ -946,7 +946,7 @@ static int jfs_symlink(struct user_namespace *mnt_userns, struct inode *dip, ...@@ -946,7 +946,7 @@ static int jfs_symlink(struct user_namespace *mnt_userns, struct inode *dip,
if (ssize <= IDATASIZE) { if (ssize <= IDATASIZE) {
ip->i_op = &jfs_fast_symlink_inode_operations; ip->i_op = &jfs_fast_symlink_inode_operations;
ip->i_link = JFS_IP(ip)->i_inline; ip->i_link = JFS_IP(ip)->i_inline_all;
memcpy(ip->i_link, name, ssize); memcpy(ip->i_link, name, ssize);
ip->i_size = ssize - 1; ip->i_size = ssize - 1;
......
...@@ -745,8 +745,7 @@ static ssize_t jfs_quota_read(struct super_block *sb, int type, char *data, ...@@ -745,8 +745,7 @@ static ssize_t jfs_quota_read(struct super_block *sb, int type, char *data,
len = i_size-off; len = i_size-off;
toread = len; toread = len;
while (toread > 0) { while (toread > 0) {
tocopy = sb->s_blocksize - offset < toread ? tocopy = min_t(size_t, sb->s_blocksize - offset, toread);
sb->s_blocksize - offset : toread;
tmp_bh.b_state = 0; tmp_bh.b_state = 0;
tmp_bh.b_size = i_blocksize(inode); tmp_bh.b_size = i_blocksize(inode);
...@@ -785,8 +784,7 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type, ...@@ -785,8 +784,7 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type,
inode_lock(inode); inode_lock(inode);
while (towrite > 0) { while (towrite > 0) {
tocopy = sb->s_blocksize - offset < towrite ? tocopy = min_t(size_t, sb->s_blocksize - offset, towrite);
sb->s_blocksize - offset : towrite;
tmp_bh.b_state = 0; tmp_bh.b_state = 0;
tmp_bh.b_size = i_blocksize(inode); tmp_bh.b_size = i_blocksize(inode);
......
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