From: Dan Carpenter <error27@gmail.com>
To: oe-kbuild@lists.linux.dev,
Johannes Thumshirn <johannes.thumshirn@wdc.com>,
Damien Le Moal <Damien.LeMoal@opensource.wdc.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
linux-fsdevel@vger.kernel.org,
Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: Re: [PATCH] zonefs: add sanity check for aggregated conventional zones
Date: Mon, 7 Nov 2022 10:58:57 +0300 [thread overview]
Message-ID: <202211060620.c1JmfU3k-lkp@intel.com> (raw)
In-Reply-To: <f7e4afaca0eb337bf18231358b7e764d4cdf5c5a.1667471410.git.johannes.thumshirn@wdc.com>
Hi Johannes,
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Johannes-Thumshirn/zonefs-add-sanity-check-for-aggregated-conventional-zones/20221103-183404
patch link: https://lore.kernel.org/r/f7e4afaca0eb337bf18231358b7e764d4cdf5c5a.1667471410.git.johannes.thumshirn%40wdc.com
patch subject: [PATCH] zonefs: add sanity check for aggregated conventional zones
config: ia64-randconfig-m031-20221104
compiler: ia64-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
New smatch warnings:
fs/zonefs/super.c:1411 zonefs_init_file_inode() warn: add some parenthesis here?
fs/zonefs/super.c:1411 zonefs_init_file_inode() warn: maybe use && instead of &
fs/zonefs/super.c:1496 zonefs_create_inode() error: uninitialized symbol 'ret'.
Old smatch warnings:
fs/zonefs/super.c:797 zonefs_file_dio_append() error: uninitialized symbol 'size'.
vim +1411 fs/zonefs/super.c
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1395
1da18a296f5ba4 Damien Le Moal 2022-04-12 1396 static int zonefs_init_file_inode(struct inode *inode, struct blk_zone *zone,
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1397 enum zonefs_ztype type)
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1398 {
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1399 struct super_block *sb = inode->i_sb;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1400 struct zonefs_sb_info *sbi = ZONEFS_SB(sb);
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1401 struct zonefs_inode_info *zi = ZONEFS_I(inode);
14bdb047a54d7a Damien Le Moal 2022-05-24 1402 int ret = 0;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1403
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1404 inode->i_ino = zone->start >> sbi->s_zone_sectors_shift;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1405 inode->i_mode = S_IFREG | sbi->s_perm;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1406
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1407 zi->i_ztype = type;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1408 zi->i_zsector = zone->start;
e3c3155bc95ab6 Johannes Thumshirn 2020-07-21 1409 zi->i_zone_size = zone->len << SECTOR_SHIFT;
4113036e1dcbb0 Johannes Thumshirn 2022-11-03 1410 if (zi->i_zone_size > bdev_zone_sectors(sb->s_bdev) << SECTOR_SHIFT &&
4113036e1dcbb0 Johannes Thumshirn 2022-11-03 @1411 !sbi->s_features & ZONEFS_F_AGGRCNV) {
Needs to be !(sbi->s_features & ZONEFS_F_AGGRCNV)) {
4113036e1dcbb0 Johannes Thumshirn 2022-11-03 1412 zonefs_err(sb,
4113036e1dcbb0 Johannes Thumshirn 2022-11-03 1413 "zone size %llu doesn't match device's zone sectors %llu\n",
4113036e1dcbb0 Johannes Thumshirn 2022-11-03 1414 zi->i_zone_size,
4113036e1dcbb0 Johannes Thumshirn 2022-11-03 1415 bdev_zone_sectors(sb->s_bdev) << SECTOR_SHIFT);
4113036e1dcbb0 Johannes Thumshirn 2022-11-03 1416 return -EINVAL;
4113036e1dcbb0 Johannes Thumshirn 2022-11-03 1417 }
e3c3155bc95ab6 Johannes Thumshirn 2020-07-21 1418
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1419 zi->i_max_size = min_t(loff_t, MAX_LFS_FILESIZE,
e3c3155bc95ab6 Johannes Thumshirn 2020-07-21 1420 zone->capacity << SECTOR_SHIFT);
ccf4ad7da0d9c3 Damien Le Moal 2020-03-20 1421 zi->i_wpoffset = zonefs_check_zone_condition(inode, zone, true, true);
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1422
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1423 inode->i_uid = sbi->s_uid;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1424 inode->i_gid = sbi->s_gid;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1425 inode->i_size = zi->i_wpoffset;
e3c3155bc95ab6 Johannes Thumshirn 2020-07-21 1426 inode->i_blocks = zi->i_max_size >> SECTOR_SHIFT;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1427
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1428 inode->i_op = &zonefs_file_inode_operations;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1429 inode->i_fop = &zonefs_file_operations;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1430 inode->i_mapping->a_ops = &zonefs_file_aops;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1431
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1432 sb->s_maxbytes = max(zi->i_max_size, sb->s_maxbytes);
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1433 sbi->s_blocks += zi->i_max_size >> sb->s_blocksize_bits;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1434 sbi->s_used_blocks += zi->i_wpoffset >> sb->s_blocksize_bits;
1da18a296f5ba4 Damien Le Moal 2022-04-12 1435
87c9ce3ffec906 Damien Le Moal 2022-04-12 1436 mutex_lock(&zi->i_truncate_mutex);
87c9ce3ffec906 Damien Le Moal 2022-04-12 1437
1da18a296f5ba4 Damien Le Moal 2022-04-12 1438 /*
1da18a296f5ba4 Damien Le Moal 2022-04-12 1439 * For sequential zones, make sure that any open zone is closed first
1da18a296f5ba4 Damien Le Moal 2022-04-12 1440 * to ensure that the initial number of open zones is 0, in sync with
1da18a296f5ba4 Damien Le Moal 2022-04-12 1441 * the open zone accounting done when the mount option
1da18a296f5ba4 Damien Le Moal 2022-04-12 1442 * ZONEFS_MNTOPT_EXPLICIT_OPEN is used.
1da18a296f5ba4 Damien Le Moal 2022-04-12 1443 */
1da18a296f5ba4 Damien Le Moal 2022-04-12 1444 if (type == ZONEFS_ZTYPE_SEQ &&
1da18a296f5ba4 Damien Le Moal 2022-04-12 1445 (zone->cond == BLK_ZONE_COND_IMP_OPEN ||
1da18a296f5ba4 Damien Le Moal 2022-04-12 1446 zone->cond == BLK_ZONE_COND_EXP_OPEN)) {
1da18a296f5ba4 Damien Le Moal 2022-04-12 1447 ret = zonefs_zone_mgmt(inode, REQ_OP_ZONE_CLOSE);
87c9ce3ffec906 Damien Le Moal 2022-04-12 1448 if (ret)
87c9ce3ffec906 Damien Le Moal 2022-04-12 1449 goto unlock;
1da18a296f5ba4 Damien Le Moal 2022-04-12 1450 }
1da18a296f5ba4 Damien Le Moal 2022-04-12 1451
87c9ce3ffec906 Damien Le Moal 2022-04-12 1452 zonefs_account_active(inode);
87c9ce3ffec906 Damien Le Moal 2022-04-12 1453
87c9ce3ffec906 Damien Le Moal 2022-04-12 1454 unlock:
87c9ce3ffec906 Damien Le Moal 2022-04-12 1455 mutex_unlock(&zi->i_truncate_mutex);
87c9ce3ffec906 Damien Le Moal 2022-04-12 1456
14bdb047a54d7a Damien Le Moal 2022-05-24 1457 return ret;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1458 }
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1459
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1460 static struct dentry *zonefs_create_inode(struct dentry *parent,
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1461 const char *name, struct blk_zone *zone,
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1462 enum zonefs_ztype type)
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1463 {
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1464 struct inode *dir = d_inode(parent);
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1465 struct dentry *dentry;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1466 struct inode *inode;
1da18a296f5ba4 Damien Le Moal 2022-04-12 1467 int ret;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1468
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1469 dentry = d_alloc_name(parent, name);
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1470 if (!dentry)
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1471 return NULL;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1472
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1473 inode = new_inode(parent->d_sb);
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1474 if (!inode)
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1475 goto dput;
"ret" not initialized on this path.
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1476
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1477 inode->i_ctime = inode->i_mtime = inode->i_atime = dir->i_ctime;
1da18a296f5ba4 Damien Le Moal 2022-04-12 1478 if (zone) {
1da18a296f5ba4 Damien Le Moal 2022-04-12 1479 ret = zonefs_init_file_inode(inode, zone, type);
1da18a296f5ba4 Damien Le Moal 2022-04-12 1480 if (ret) {
1da18a296f5ba4 Damien Le Moal 2022-04-12 1481 iput(inode);
1da18a296f5ba4 Damien Le Moal 2022-04-12 1482 goto dput;
1da18a296f5ba4 Damien Le Moal 2022-04-12 1483 }
1da18a296f5ba4 Damien Le Moal 2022-04-12 1484 } else {
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1485 zonefs_init_dir_inode(dir, inode, type);
1da18a296f5ba4 Damien Le Moal 2022-04-12 1486 }
1da18a296f5ba4 Damien Le Moal 2022-04-12 1487
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1488 d_add(dentry, inode);
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1489 dir->i_size++;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1490
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1491 return dentry;
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1492
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1493 dput:
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1494 dput(dentry);
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1495
4113036e1dcbb0 Johannes Thumshirn 2022-11-03 @1496 return ERR_PTR(ret);
8dcc1a9d90c10f Damien Le Moal 2019-12-25 1497 }
--
0-DAY CI Kernel Test Service
https://01.org/lkp
prev parent reply other threads:[~2022-11-07 7:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 10:32 [PATCH] zonefs: add sanity check for aggregated conventional zones Johannes Thumshirn
2022-11-04 0:26 ` Damien Le Moal
2022-11-04 9:47 ` Johannes Thumshirn
2022-11-04 12:06 ` Damien Le Moal
2022-11-04 12:36 ` Johannes Thumshirn
2022-11-07 7:58 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202211060620.c1JmfU3k-lkp@intel.com \
--to=error27@gmail.com \
--cc=Damien.LeMoal@opensource.wdc.com \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).