diff mbox series

[v2,09/10] fs/ntfs3: Add NTFS3 in fs/Kconfig and fs/Makefile

Message ID 35de976db78443cc9ed18bcd410e6f4a@paragon-software.com (mailing list archive)
State New, archived
Headers show
Series fs: NTFS read-write driver GPL implementation by Paragon Software. | expand

Commit Message

Konstantin Komarov Aug. 21, 2020, 4:25 p.m. UTC
This adds NTFS3 in fs/Kconfig and fs/Makefile

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
---
 fs/Kconfig  | 1 +
 fs/Makefile | 1 +
 2 files changed, 2 insertions(+)

Comments

kernel test robot Aug. 21, 2020, 7:19 p.m. UTC | #1
Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v5.9-rc1 next-20200821]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Konstantin-Komarov/fs-NTFS-read-write-driver-GPL-implementation-by-Paragon-Software/20200822-003353
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git bcf876870b95592b52519ed4aafcf9d95999bc9c
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   fs/ntfs3/inode.c: In function 'ntfs_read_mft':
>> fs/ntfs3/inode.c:40:7: warning: variable 'is_encrypted' set but not used [-Wunused-but-set-variable]
      40 |  bool is_encrypted = false;
         |       ^~~~~~~~~~~~
--
   fs/ntfs3/fsntfs.c: In function 'ntfs_extend_init':
>> fs/ntfs3/fsntfs.c:171:14: warning: variable 'ni' set but not used [-Wunused-but-set-variable]
     171 |  ntfs_inode *ni;
         |              ^~
   fs/ntfs3/fsntfs.c: In function 'ntfs_loadlog_and_replay':
>> fs/ntfs3/fsntfs.c:241:11: warning: variable 'log_size' set but not used [-Wunused-but-set-variable]
     241 |  u32 idx, log_size;
         |           ^~~~~~~~
   fs/ntfs3/fsntfs.c: In function 'ntfs_insert_security':
>> fs/ntfs3/fsntfs.c:1764:6: warning: variable 'used' set but not used [-Wunused-but-set-variable]
    1764 |  u32 used, next, left;
         |      ^~~~
--
   fs/ntfs3/frecord.c: In function 'ni_ins_attr_ext':
>> fs/ntfs3/frecord.c:670:11: warning: variable 'rec' set but not used [-Wunused-but-set-variable]
     670 |  MFT_REC *rec;
         |           ^~~
--
   fs/ntfs3/index.c: In function 'indx_find_sort':
>> fs/ntfs3/index.c:1148:6: warning: variable 'err' set but not used [-Wunused-but-set-variable]
    1148 |  int err;
         |      ^~~
--
   fs/ntfs3/attrib.c: In function 'attr_set_size':
>> fs/ntfs3/attrib.c:478:10: warning: variable 'cnt' set but not used [-Wunused-but-set-variable]
     478 |   size_t cnt, free;
         |          ^~~
   fs/ntfs3/attrib.c: In function 'attr_data_get_block':
>> fs/ntfs3/attrib.c:769:28: warning: variable 'new_alloc' set but not used [-Wunused-but-set-variable]
     769 |  u64 new_size, total_size, new_alloc;
         |                            ^~~~~~~~~
--
   fs/ntfs3/super.c: In function 'ntfs_fill_super':
>> fs/ntfs3/super.c:831:16: warning: unsigned conversion from 'long long int' to 'long unsigned int' changes value from '220979426414' to '1936094318' [-Woverflow]
     831 |  sb->s_magic = 0x337366746e; // "ntfs3"
         |                ^~~~~~~~~~~~
--
   fs/ntfs3/fslog.c: In function 'log_replay':
>> fs/ntfs3/fslog.c:3895:7: warning: variable 'vbo_to_clear' set but not used [-Wunused-but-set-variable]
    3895 |   u32 vbo_to_clear = page_size * 2;
         |       ^~~~~~~~~~~~
>> fs/ntfs3/fslog.c:3894:8: warning: variable 'clear_log' set but not used [-Wunused-but-set-variable]
    3894 |   bool clear_log = true;
         |        ^~~~~~~~~
>> fs/ntfs3/fslog.c:3780:17: warning: variable 'clst_off' set but not used [-Wunused-but-set-variable]
    3780 |  u32 saved_len, clst_off, rec_len, transact_id;
         |                 ^~~~~~~~

# https://github.com/0day-ci/linux/commit/cc8413bd463338b0ad2b6369a619196d5b77798a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Konstantin-Komarov/fs-NTFS-read-write-driver-GPL-implementation-by-Paragon-Software/20200822-003353
git checkout cc8413bd463338b0ad2b6369a619196d5b77798a
vim +/is_encrypted +40 fs/ntfs3/inode.c

9106c639ce09ddc Konstantin Komarov 2020-08-21   22  
9106c639ce09ddc Konstantin Komarov 2020-08-21   23  /*
9106c639ce09ddc Konstantin Komarov 2020-08-21   24   * ntfs_read_mft
9106c639ce09ddc Konstantin Komarov 2020-08-21   25   *
9106c639ce09ddc Konstantin Komarov 2020-08-21   26   * reads record and parses MFT
9106c639ce09ddc Konstantin Komarov 2020-08-21   27   */
9106c639ce09ddc Konstantin Komarov 2020-08-21   28  static struct inode *ntfs_read_mft(struct inode *inode,
9106c639ce09ddc Konstantin Komarov 2020-08-21   29  				   const struct cpu_str *name,
9106c639ce09ddc Konstantin Komarov 2020-08-21   30  				   const MFT_REF *ref)
9106c639ce09ddc Konstantin Komarov 2020-08-21   31  {
9106c639ce09ddc Konstantin Komarov 2020-08-21   32  	int err = 0;
9106c639ce09ddc Konstantin Komarov 2020-08-21   33  	ntfs_inode *ni = ntfs_i(inode);
9106c639ce09ddc Konstantin Komarov 2020-08-21   34  	struct super_block *sb = inode->i_sb;
9106c639ce09ddc Konstantin Komarov 2020-08-21   35  	ntfs_sb_info *sbi = sb->s_fs_info;
9106c639ce09ddc Konstantin Komarov 2020-08-21   36  	mode_t mode = 0;
9106c639ce09ddc Konstantin Komarov 2020-08-21   37  	ATTR_STD_INFO5 *std5 = NULL;
9106c639ce09ddc Konstantin Komarov 2020-08-21   38  	ATTR_LIST_ENTRY *le;
9106c639ce09ddc Konstantin Komarov 2020-08-21   39  	ATTRIB *attr;
9106c639ce09ddc Konstantin Komarov 2020-08-21  @40  	bool is_encrypted = false;
9106c639ce09ddc Konstantin Komarov 2020-08-21   41  	bool is_match = false;
9106c639ce09ddc Konstantin Komarov 2020-08-21   42  	bool is_root = false;
9106c639ce09ddc Konstantin Komarov 2020-08-21   43  	bool is_dir;
9106c639ce09ddc Konstantin Komarov 2020-08-21   44  	unsigned long ino = inode->i_ino;
9106c639ce09ddc Konstantin Komarov 2020-08-21   45  	u32 rp_fa = 0, asize, t32;
9106c639ce09ddc Konstantin Komarov 2020-08-21   46  	u16 roff, rsize, names = 0;
9106c639ce09ddc Konstantin Komarov 2020-08-21   47  	const ATTR_FILE_NAME *fname = NULL;
9106c639ce09ddc Konstantin Komarov 2020-08-21   48  	const INDEX_ROOT *root;
9106c639ce09ddc Konstantin Komarov 2020-08-21   49  	REPARSE_DATA_BUFFER rp; // 0x18 bytes
9106c639ce09ddc Konstantin Komarov 2020-08-21   50  	u64 t64;
9106c639ce09ddc Konstantin Komarov 2020-08-21   51  	MFT_REC *rec;
9106c639ce09ddc Konstantin Komarov 2020-08-21   52  	struct runs_tree *run;
9106c639ce09ddc Konstantin Komarov 2020-08-21   53  
9106c639ce09ddc Konstantin Komarov 2020-08-21   54  	inode->i_op = NULL;
9106c639ce09ddc Konstantin Komarov 2020-08-21   55  
9106c639ce09ddc Konstantin Komarov 2020-08-21   56  	err = mi_init(&ni->mi, sbi, ino);
9106c639ce09ddc Konstantin Komarov 2020-08-21   57  	if (err)
9106c639ce09ddc Konstantin Komarov 2020-08-21   58  		goto out;
9106c639ce09ddc Konstantin Komarov 2020-08-21   59  
9106c639ce09ddc Konstantin Komarov 2020-08-21   60  	if (!sbi->mft.ni && ino == MFT_REC_MFT && !sb->s_root) {
9106c639ce09ddc Konstantin Komarov 2020-08-21   61  		t64 = sbi->mft.lbo >> sbi->cluster_bits;
9106c639ce09ddc Konstantin Komarov 2020-08-21   62  		t32 = bytes_to_cluster(sbi, MFT_REC_VOL * sbi->record_size);
9106c639ce09ddc Konstantin Komarov 2020-08-21   63  		sbi->mft.ni = ni;
9106c639ce09ddc Konstantin Komarov 2020-08-21   64  		init_rwsem(&ni->file.run_lock);
9106c639ce09ddc Konstantin Komarov 2020-08-21   65  
9106c639ce09ddc Konstantin Komarov 2020-08-21   66  		if (!run_add_entry(&ni->file.run, 0, t64, t32)) {
9106c639ce09ddc Konstantin Komarov 2020-08-21   67  			err = -ENOMEM;
9106c639ce09ddc Konstantin Komarov 2020-08-21   68  			goto out;
9106c639ce09ddc Konstantin Komarov 2020-08-21   69  		}
9106c639ce09ddc Konstantin Komarov 2020-08-21   70  	}
9106c639ce09ddc Konstantin Komarov 2020-08-21   71  
9106c639ce09ddc Konstantin Komarov 2020-08-21   72  	err = mi_read(&ni->mi, ino == MFT_REC_MFT);
9106c639ce09ddc Konstantin Komarov 2020-08-21   73  
9106c639ce09ddc Konstantin Komarov 2020-08-21   74  	if (err)
9106c639ce09ddc Konstantin Komarov 2020-08-21   75  		goto out;
9106c639ce09ddc Konstantin Komarov 2020-08-21   76  
9106c639ce09ddc Konstantin Komarov 2020-08-21   77  	rec = ni->mi.mrec;
9106c639ce09ddc Konstantin Komarov 2020-08-21   78  
9106c639ce09ddc Konstantin Komarov 2020-08-21   79  	if (sbi->flags & NTFS_FLAGS_LOG_REPLAING)
9106c639ce09ddc Konstantin Komarov 2020-08-21   80  		;
9106c639ce09ddc Konstantin Komarov 2020-08-21   81  	else if (ref->seq != rec->seq) {
9106c639ce09ddc Konstantin Komarov 2020-08-21   82  		err = -EINVAL;
9106c639ce09ddc Konstantin Komarov 2020-08-21   83  		ntfs_error(sb, "MFT: r=%lx, expect seq=%x instead of %x!", ino,
9106c639ce09ddc Konstantin Komarov 2020-08-21   84  			   le16_to_cpu(ref->seq), le16_to_cpu(rec->seq));
9106c639ce09ddc Konstantin Komarov 2020-08-21   85  		goto out;
9106c639ce09ddc Konstantin Komarov 2020-08-21   86  	} else if (!is_rec_inuse(rec)) {
9106c639ce09ddc Konstantin Komarov 2020-08-21   87  		err = -EINVAL;
9106c639ce09ddc Konstantin Komarov 2020-08-21   88  		ntfs_error(sb, "Inode r=%x is not in use!", (u32)ino);
9106c639ce09ddc Konstantin Komarov 2020-08-21   89  		goto out;
9106c639ce09ddc Konstantin Komarov 2020-08-21   90  	}
9106c639ce09ddc Konstantin Komarov 2020-08-21   91  
9106c639ce09ddc Konstantin Komarov 2020-08-21   92  	if (le32_to_cpu(rec->total) != sbi->record_size) {
9106c639ce09ddc Konstantin Komarov 2020-08-21   93  		// bad inode?
9106c639ce09ddc Konstantin Komarov 2020-08-21   94  		err = -EINVAL;
9106c639ce09ddc Konstantin Komarov 2020-08-21   95  		goto out;
9106c639ce09ddc Konstantin Komarov 2020-08-21   96  	}
9106c639ce09ddc Konstantin Komarov 2020-08-21   97  
9106c639ce09ddc Konstantin Komarov 2020-08-21   98  	if (!is_rec_base(rec))
9106c639ce09ddc Konstantin Komarov 2020-08-21   99  		goto Ok;
9106c639ce09ddc Konstantin Komarov 2020-08-21  100  
9106c639ce09ddc Konstantin Komarov 2020-08-21  101  	/* record should contain $I30 root */
9106c639ce09ddc Konstantin Komarov 2020-08-21  102  	is_dir = rec->flags & RECORD_FLAG_DIR;
9106c639ce09ddc Konstantin Komarov 2020-08-21  103  
9106c639ce09ddc Konstantin Komarov 2020-08-21  104  	inode->i_generation = le16_to_cpu(rec->seq);
9106c639ce09ddc Konstantin Komarov 2020-08-21  105  
9106c639ce09ddc Konstantin Komarov 2020-08-21  106  	/* Enumerate all struct Attributes MFT */
9106c639ce09ddc Konstantin Komarov 2020-08-21  107  	le = NULL;
9106c639ce09ddc Konstantin Komarov 2020-08-21  108  	attr = NULL;
9106c639ce09ddc Konstantin Komarov 2020-08-21  109  next_attr:
9106c639ce09ddc Konstantin Komarov 2020-08-21  110  	err = -EINVAL;
9106c639ce09ddc Konstantin Komarov 2020-08-21  111  	attr = ni_enum_attr_ex(ni, attr, &le);
9106c639ce09ddc Konstantin Komarov 2020-08-21  112  	if (!attr)
9106c639ce09ddc Konstantin Komarov 2020-08-21  113  		goto end_enum;
9106c639ce09ddc Konstantin Komarov 2020-08-21  114  
9106c639ce09ddc Konstantin Komarov 2020-08-21  115  	if (le && le->vcn) {
9106c639ce09ddc Konstantin Komarov 2020-08-21  116  		if (ino == MFT_REC_MFT && attr->type == ATTR_DATA) {
9106c639ce09ddc Konstantin Komarov 2020-08-21  117  			run = &ni->file.run;
9106c639ce09ddc Konstantin Komarov 2020-08-21  118  			asize = le32_to_cpu(attr->size);
9106c639ce09ddc Konstantin Komarov 2020-08-21  119  			goto attr_unpack_run;
9106c639ce09ddc Konstantin Komarov 2020-08-21  120  		}
9106c639ce09ddc Konstantin Komarov 2020-08-21  121  		goto next_attr;
9106c639ce09ddc Konstantin Komarov 2020-08-21  122  	}
9106c639ce09ddc Konstantin Komarov 2020-08-21  123  
9106c639ce09ddc Konstantin Komarov 2020-08-21  124  	roff = attr->non_res ? 0 : le16_to_cpu(attr->res.data_off);
9106c639ce09ddc Konstantin Komarov 2020-08-21  125  	rsize = attr->non_res ? 0 : le32_to_cpu(attr->res.data_size);
9106c639ce09ddc Konstantin Komarov 2020-08-21  126  	asize = le32_to_cpu(attr->size);
9106c639ce09ddc Konstantin Komarov 2020-08-21  127  
9106c639ce09ddc Konstantin Komarov 2020-08-21  128  	if (attr->type != ATTR_STD)
9106c639ce09ddc Konstantin Komarov 2020-08-21  129  		goto check_list;
9106c639ce09ddc Konstantin Komarov 2020-08-21  130  
9106c639ce09ddc Konstantin Komarov 2020-08-21  131  	if (attr->non_res)
9106c639ce09ddc Konstantin Komarov 2020-08-21  132  		goto out;
9106c639ce09ddc Konstantin Komarov 2020-08-21  133  
9106c639ce09ddc Konstantin Komarov 2020-08-21  134  	if (asize < sizeof(ATTR_STD_INFO) + roff)
9106c639ce09ddc Konstantin Komarov 2020-08-21  135  		goto out;
9106c639ce09ddc Konstantin Komarov 2020-08-21  136  	if (rsize < sizeof(ATTR_STD_INFO))
9106c639ce09ddc Konstantin Komarov 2020-08-21  137  		goto out;
9106c639ce09ddc Konstantin Komarov 2020-08-21  138  
9106c639ce09ddc Konstantin Komarov 2020-08-21  139  	if (std5)
9106c639ce09ddc Konstantin Komarov 2020-08-21  140  		goto next_attr;
9106c639ce09ddc Konstantin Komarov 2020-08-21  141  
9106c639ce09ddc Konstantin Komarov 2020-08-21  142  	std5 = Add2Ptr(attr, roff);
9106c639ce09ddc Konstantin Komarov 2020-08-21  143  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Aug. 22, 2020, 1:45 a.m. UTC | #2
Hi Konstantin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on linus/master v5.9-rc1 next-20200821]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Konstantin-Komarov/fs-NTFS-read-write-driver-GPL-implementation-by-Paragon-Software/20200822-003353
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git bcf876870b95592b52519ed4aafcf9d95999bc9c
config: h8300-allyesconfig (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   In file included from include/asm-generic/bug.h:5,
                    from arch/h8300/include/asm/bug.h:8,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:12,
                    from include/asm-generic/current.h:5,
                    from ./arch/h8300/include/generated/asm/current.h:1,
                    from include/linux/sched.h:12,
                    from include/linux/blkdev.h:5,
                    from fs/ntfs3/fslog.c:9:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   include/asm-generic/page.h:93:50: warning: ordered comparison of pointer with null pointer [-Wextra]
      93 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
         |                                                  ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |  ^~~~~~
   include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |          ^~~~~~~~~~~~~~~
   fs/ntfs3/fslog.c: In function 'log_replay':
   fs/ntfs3/fslog.c:3895:7: warning: variable 'vbo_to_clear' set but not used [-Wunused-but-set-variable]
    3895 |   u32 vbo_to_clear = page_size * 2;
         |       ^~~~~~~~~~~~
   fs/ntfs3/fslog.c:3894:8: warning: variable 'clear_log' set but not used [-Wunused-but-set-variable]
    3894 |   bool clear_log = true;
         |        ^~~~~~~~~
   fs/ntfs3/fslog.c:3780:17: warning: variable 'clst_off' set but not used [-Wunused-but-set-variable]
    3780 |  u32 saved_len, clst_off, rec_len, transact_id;
         |                 ^~~~~~~~
   fs/ntfs3/fslog.c: In function 'last_log_lsn':
>> fs/ntfs3/fslog.c:2241:1: warning: the frame size of 1044 bytes is larger than 1024 bytes [-Wframe-larger-than=]
    2241 | }
         | ^
--
   h8300-linux-ld: fs/ntfs3/file.o: in function `ntfs_setattr':
>> file.c:(.text+0x3ca0): multiple definition of `ntfs_setattr'; fs/ntfs/inode.o:inode.c:(.text+0x9000): first defined here

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/fs/Kconfig b/fs/Kconfig
index aa4c12282301..eae96d55ab67 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -145,6 +145,7 @@  menu "DOS/FAT/EXFAT/NT Filesystems"
 source "fs/fat/Kconfig"
 source "fs/exfat/Kconfig"
 source "fs/ntfs/Kconfig"
+source "fs/ntfs3/Kconfig"
 
 endmenu
 endif # BLOCK
diff --git a/fs/Makefile b/fs/Makefile
index 1c7b0e3f6daa..b0b4ad8affa0 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -100,6 +100,7 @@  obj-$(CONFIG_SYSV_FS)		+= sysv/
 obj-$(CONFIG_CIFS)		+= cifs/
 obj-$(CONFIG_HPFS_FS)		+= hpfs/
 obj-$(CONFIG_NTFS_FS)		+= ntfs/
+obj-$(CONFIG_NTFS3_FS)		+= ntfs3/
 obj-$(CONFIG_UFS_FS)		+= ufs/
 obj-$(CONFIG_EFS_FS)		+= efs/
 obj-$(CONFIG_JFFS2_FS)		+= jffs2/