Commit Graph
24 Commits
Author SHA1 Message Date
a17671 b736076b7f fs:exfat-linux:Integrate exfat-linux open source driver
Opensource exfat-linux driver provide better performance
Comparing with the existing Moto exfat-nofuse
It could support various kernel versions l(CR) 5.4/4.19/4.14/4.9
Original source :https://github.com/arter97/exfat-linux.git
version 5.8-2arter97
This commit also integrates almost all the exfat upstream
changes from kernel 5.8-5.16 listed in:
https://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat.git/log/fs/exfat?h=exfat-for-5.16-rc1

Change-Id: I7c0db070ee33be8f7f24a42f987b4e825d957998
Signed-off-by: a17671 <a17671@motorola.com>
Reviewed-on: https://gerrit.mot.com/2137224
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Xinmin Fu <fuxm1@motorola.com>
Reviewed-by: Chuanchun Zhu <zhucc2@motorola.com>
Reviewed-by: Xiaojun Ji <jixj@motorola.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
2021-12-15 23:10:34 -06:00
a17671 51eb207822 exfat:Fix panic of handlings of unhashed alias
Unhashed alias is allowed to exist
In the latest upstream kernel exfat driver
It does not have to generate panic in this case
Porting this handling to exfat-nofuse driver from url
https://git.kernel.org/pub/scm/linux/kernel/git/
stable/linux.git/tree/fs/exfat/namei.c?h=v5.10.8#n724

Panic stack trace:
kernel BUG at ../../motorola/kernel/modules/fs/exfat/exfat_super.c:874!
[  759.284483] pc : exfat_lookup+0x1dc/0x1e0 [exfat]
[  759.284496] lr : exfat_lookup+0x144/0x1e0 [exfat]
[  759.284502] sp : ffffff800ea2b9d0
[  759.284507] x29: ffffff800ea2ba20 x28: fffffff6f3cf8000
[  759.284515] x27: 0000000000000000 x26: 0000000000000000
[  759.284523] x25: 0000000056000000 x24: fffffff7b8742d88
[  759.284530] x23: 0000000000004000 x22: fffffff883b08390
[  759.284538] x21: fffffff7b874b228 x20: fffffff86d375000
[  759.284546] x19: fffffff883b08980 x18: 0000000007270df4
[  759.284553] x17: 0000000000000000 x16: ffffff9bebd5c9b8
[  759.284561] x15: fffffff6f976ba00 x14: 0000000000000041
[  759.284569] x13: ffffff9bede96590 x12: fffffff6f89f7b00
[  759.284576] x11: 2cf70e9f45774b00 x10: 0000000000000000
[  759.284584] x9 : 0000000000000000 x8 : 0000000000000000
[  759.284591] x7 : ffffff9bec02e394 x6 : 0000000000000000
[  759.284599] x5 : 0000000000000000 x4 : 0000000000000001
[  759.284606] x3 : 0000000000000000 x2 : ffffff9bebd5ca84
[  759.284614] x1 : 0000000000000001 x0 : fffffff883b08390
[  759.284622] Call trace:
[  759.284636]  exfat_lookup+0x1dc/0x1e0 [exfat]
[  759.284650]  __lookup_slow+0x9c/0x188
[  759.284658]  walk_component+0x1d0/0x868
[  759.284665]  path_lookupat+0xb8/0x210
[  759.284672]  filename_lookup+0x98/0x1c8
[  759.284679]  user_path_at_empty+0x54/0x68
[  759.284688]  vfs_statx+0x90/0x130
[  759.284695]  __arm64_sys_newfstatat+0x40/0x80
[  759.284704]  el0_svc_common+0xa0/0x170
[  759.284711]  el0_svc_handler+0x6c/0x88
[  759.284719]  el0_svc+0x8/0xc
[  759.284728] Code: 17ffffa7 92800176 17ffffec 940018f2 (d4210000)

Change-Id: I5fb26e2416f70733fe2010484740513dc9a8c5d0
Signed-off-by: a17671 <a17671@motorola.com>
Reviewed-on: https://gerrit.mot.com/1853335
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
2021-01-19 19:32:36 -06:00
zhucc2 c920f5bf83 exfat: fix build err on user build.
After SM4350 ES FC rebase, find some API are delete by Google in GKI.
we have to workround as below:
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/../../kernel/
msm-$(MODULE_KERNEL_VERSION)/Module.symvers

ERROR: "truncate_setsize" [../../motorola/kernel/modules/fs/exfat/exfat.ko] undefined!
ERROR: "setattr_prepare" [../../motorola/kernel/modules/fs/exfat/exfat.ko] undefined!
ERROR: "clear_nlink" [../../motorola/kernel/modules/fs/exfat/exfat.ko] undefined!
ERROR: "set_nlink" [../../motorola/kernel/modules/fs/exfat/exfat.ko] undefined!
ERROR: "d_splice_alias" [../../motorola/kernel/modules/fs/exfat/exfat.ko] undefined!
ERROR: "igrab" [../../motorola/kernel/modules/fs/exfat/exfat.ko] undefined!

Change-Id: I9399a691ee70485a157e33243c7095c38ab37290
Reviewed-on: https://gerrit.mot.com/1796098
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
2020-11-06 04:43:04 -06:00
zhucc2 1db3478963 exfat: workround end_buffer_async_write undefine issue in GKI 5.4
workround end_buffer_async_write undefine issue in GKI 5.4:
ERROR: "end_buffer_async_write" [../../motorola/kernel/modules/fs/exfat/exfat.ko] undefined!
and moto code enable "end_buffer_write_sync" as defual.

Change-Id: I4851ca61e661cbe300b394ef4b7a01f8bc87fec5
Reviewed-on: https://gerrit.mot.com/1783223
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Xiaojun Ji <jixj@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
2020-10-25 20:17:25 -05:00
yuedl1 371fad72cb exfat:fixed exfat compliling failed on kernel 5.4
fixed exfat compliling failed on kernel 5.4 , due to MS_RDONLY and
MS_NODIRATIME flag is just used for mounting, if file system need
used SB_*.

Change-Id: Icf8bb0595bd2aacefcc3bbf6bc81c48f103af6bf
Signed-off-by: yuedl1 <yuedl1@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1773673
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Dongliang Yue <yuedl1@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
2020-10-14 20:44:32 -05:00
yuedl1 48b1ef558f exfat:fixed fs_error access null pointer
when exfat unmounted, but fs_error maybe callbacked by block layer
still.so just check whether the sb and sb_fs_info was released.

Change-Id: I30f55a2f3a20cbaecccbcf12d143590a02d1bf19
Signed-off-by: yuedl1 <yuedl1@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1708296
Tested-by: Jira Key
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Reviewed-by: Zhenxin Xi <xizx@motorola.com>
Submit-Approved: Jira Key
2020-07-29 01:44:44 -05:00
zhucc2 3c50a7591f exfat: use kvzalloc instead kzalloc in exfat_fill_super().
kzalloc maybe fail when memory fragmented, there is not enough contiguous
memory to used.
04-17 02:19:20.788   672 11313 D vold    : File system checking finished.
No errors found.
04-17 02:19:20.788   672 11313 D vold    :
04-17 02:19:20.788   672 11313 I vold    : Check OK
04-17 02:19:20.816   672 11313 E vold    : Mount failed; attempting
read-only: Out of memory
04-17 02:19:20.818   672 11313 E vold    : public:8,97 failed to mount
/dev/block/vold/public:8,97: Out of memory

Binder  : 672_7: page allocation failure: order:4, mode:0x60c0c0
(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), nodemask=(null)

Change-Id: I20b687ffdc26742f9e938668ee8e016c3bb3af1b
Reviewed-on: https://gerrit.mot.com/1541702
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Dongliang Yue <yuedl1@motorola.com>
Reviewed-by: Xiaojun Ji <jixj@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
2020-04-28 20:36:30 -05:00
Chuanchun Zhu 5c531b9ed3 Revert "(CR): exfat: use kvzalloc instead kzalloc in exfat_fill_super()."
compile fail when  kernel version < 4.14, we need check and recommit later.

This reverts commit 71ab0b07650e2f41f45ff087abce284fd2176e9e.

Change-Id: Idaeea78203c84127713f9a49cb0ce264c5faMontanaa
Reviewed-on: https://gerrit.mot.com/1541523
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
2020-04-23 22:01:15 -05:00
zhucc2 fd5e126865 exfat: use kvzalloc instead kzalloc in exfat_fill_super().
kzalloc maybe fail when memory fragmented, there is not enough contiguous
memory to used.
04-17 02:19:20.788   672 11313 D vold    : File system checking finished.
No errors found.
04-17 02:19:20.788   672 11313 D vold    :
04-17 02:19:20.788   672 11313 I vold    : Check OK
04-17 02:19:20.816   672 11313 E vold    : Mount failed; attempting
read-only: Out of memory
04-17 02:19:20.818   672 11313 E vold    : public:8,97 failed to mount
/dev/block/vold/public:8,97: Out of memory

Binder  : 672_7: page allocation failure: order:4, mode:0x60c0c0
(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), nodemask=(null)

Change-Id: I7bb92c672bdf2b2f777871d5f12f793b34d36b7f
Reviewed-on: https://gerrit.mot.com/1539365
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Shi-Yong Li <a22381@motorola.com>
Reviewed-by: Dongliang Yue <yuedl1@motorola.com>
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key
2020-04-23 20:41:33 -05:00
zhucc2 e50168cc66 Exfat:fix compile fail on kernel-4.19
For Kernel-4.19 add some new APIs, Exfat-nofuse need apply some patches,
or compile will fail.
patch list:
https://github.com/barrybingo/exfat-nofuse/commit/f93a47e6414d567a1e7f6ab7f34b015b20f9a050
https://github.com/barrybingo/exfat-nofuse/commit/e95c8847b07059d2f41cd924af5486feea25f26d
Change-Id: Ic1737e3ea09ece27fce7cb969b838e50d9569ffe
Reviewed-on: https://gerrit.mot.com/1478458
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Dongliang Yue <yuedl1@motorola.com>
Reviewed-by: Shi-Yong Li <a22381@motorola.com>
Reviewed-by: Zhenxin Xi <xizx@motorola.com>
Submit-Approved: Jira Key
2020-01-07 00:43:11 -06:00
sunyue5 41cee75c18 exfat: avoid uniname accessing invalid address
In exfat_find_dir_entry, if there doesn't have a TYPE_STREAM(0xc0) entry
before TYPE_EXTEND(0xc1), it will cause kernel panic for the kernel poniter
uniname accessing invalid address

Propogated from OMR1.

Change-Id: Ic8063eafc1c458c96c18a96d58dacd8f33695bb2
Signed-off-by: sunyue5 <sunyue5@motorola.com>
Reviewed-on: https://gerrit.mot.com/1235768
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yue Sun <sunyue5@lenovo.com>
Reviewed-by: Konstantin Makariev <kmakariev@motorola.com>
Submit-Approved: Jira Key
Signed-off-by: yuedl1 <yuedl1@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1290985
Reviewed-by: Shi-Yong Li <a22381@motorola.com>
Reviewed-by: Zhenxin Xi <xizx@motorola.com>
2019-01-08 20:40:12 -06:00
Shiyong Li 4384ecdec8 fs/exfat: fix compile error on kernel 4.14
WRITE_SYNC is not defined on new kernel.

Change-Id: If47e84c06a0e52ccf4a7a116d233f8d8c924191e
Signed-off-by: Shiyong Li <a22381@motorola.com>
Reviewed-on: https://gerrit.mot.com/1207791
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Ling Jin <lingjin@motorola.com>
Submit-Approved: Jira Key
2018-07-31 12:46:45 -05:00
Shiyong Li 5b026089e1 fs/exfat: reduce log spam
Switch to debug prints for some spammy errors.

Change-Id: I847d21fcaa4a66b0521e43c62fe7d7b6c1e140d7
Signed-off-by: Igor Kovalenko <c(CR)@motorola.com>
Signed-off-by: Shiyong Li <a22381@motorola.com>
Reviewed-on: https://gerrit.mot.com/1102185
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key
2017-12-12 12:35:59 -06:00
Shiyong Li 9e75018bbf fs/exfat: do error check for d_splice_alias return
This patch adds error check in case a defect exFAT SD cards is inserted.

Change-Id: I37f6b8716abd556908aad72b18fcc7ac5719766e
Signed-off-by: Min Shi <e13386@motorola.com>
Signed-off-by: Shiyong Li <a22381@motorola.com>
Reviewed-on: https://gerrit.mot.com/1102184
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key
2017-12-12 12:35:30 -06:00
Shiyong Li f961c72ccb fs/exfat: fix every bio only has one block
This patch fix the bug that exfat fs cannot write
continuous blocks in one bio.
This will cause every request submit in block layer
only contains one block, cause write speed slower.

Change-Id: Ia548a7d8051defc1498d2d11d39e069bf683fdff
Signed-off-by: haojl2 <haojl2@motorola.com>
Signed-off-by: Shiyong Li <a22381@motorola.com>
Reviewed-on: https://gerrit.mot.com/1102183
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key
2017-12-12 12:35:22 -06:00
Shiyong Li 5b326dd273 fs/exfat: send uevnet from workqueue
We can not send uevent directly because it might be called
from atomic context.

Change-Id: I384a7f197b22b1fcb8d068c98908e4fa5a1d3b82
Signed-off-by: Lianwei Wang <a22439@motorola.com>
Signed-off-by: Shiyong Li <a22381@motorola.com>
Reviewed-on: https://gerrit.mot.com/1102182
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key
2017-12-12 12:35:16 -06:00
Shiyong Li 5b7325a279 fs/exfat: support readonly uevent
Change-Id: Iba732aa27cce07133bdbc085bee10182f5796298
Signed-off-by: Lianwei Wang <a22439@motorola.com>
Signed-off-by: Shiyong Li <a22381@motorola.com>
Reviewed-on: https://gerrit.mot.com/1102181
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key
2017-12-12 12:35:08 -06:00
Shiyong Li 251b18ea98 fs/exfat: use correct length for utf conversion
when call utf16s_to_utf8s, last parmater 'maxout' will be reduced
with the returned value of utf32_to_utf8, the value reflects the
size of one utf character, it could be 1~max charset size(3), so
maxout should use MAX_NAME_LENGTH * MAX_CHARSET_SIZE
when call utf8s_to_utf16s, the inlen will be reduced with the
the returned value of utf8_to_utf32, so it should use
MAX_NAME_LENGTH * MAX_CHARSET_SIZE or the lenghth of p_cstring whose
max value is MAX_NAME_LENGTH * MAX_CHARSET_SIZE.

Change-Id: Icbea02ece4b1a5b015037a6a54178ee8e08d4325
Signed-off-by: Shengzhe Zhao <a18689@motorola.com>
Signed-off-by: Shiyong Li <a22381@motorola.com>
Reviewed-on: https://gerrit.mot.com/1102180
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key
2017-12-12 12:35:02 -06:00
Shiyong Li a77212a42c fs/exfat: avoid setting 0 over buffer uniname
utf8s_to_utf16s could return -EINVAL(-22), then uniname[i] =
uniname[-22] = '\0' will corrupt other local variable.
uniname is a local variable having different address everytime
when call nls_cstring_to_uniname. so uniname[-22] could corrupt
some different addresses.
and also when filename reaches at maximum length, need to leave
last one space in buffer for '\0'

Change-Id: I44bbdd3249150ad5617c7cd13207cfa37b102a77
Signed-off-by: Shengzhe Zhao <a18689@motorola.com>
Signed-off-by: Shiyong Li <a22381@motorola.com>
Reviewed-on: https://gerrit.mot.com/1102179
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key
2017-12-12 12:34:55 -06:00
Shiyong Li 27dcc525e6 fs/exfat: unlock pages under readonly status
The ->writepage should unlock its page before returning the results.
Otherwise, evict_inode can be hanged while truncating pages.

- Backtrace -

(__schedule+0x3dc/0x908) from [<c0b67854>] (io_schedule+0x6c/0x94)
(io_schedule+0x6c/0x94) from [<c01ce2dc>] (sleep_on_page+0x8/0x10)
(sleep_on_page+0x8/0x10) from [<c0b64e70>] (__wait_on_bit_lock+0x6c/0xb8)
(__wait_on_bit_lock+0x6c/0xb8) from [<c01ce418>] (__lock_page+0x90/0x98)
(__lock_page+0x90/0x98) from [<c01dcae8>] (truncate_inode_pages_range+0x360/0x37c)
(truncate_inode_pages_range+0x360/0x37c) from [<c01dcb1c>] (truncate_inode_pages+0x18/0x20)
(truncate_inode_pages+0x18/0x20) from [<c0304618>] (exfat_evict_inode+0x18/0xb0)
(exfat_evict_inode+0x18/0xb0) from [<c0228590>] (evict+0x94/0x178)
(evict+0x94/0x178) from [<c02286a4>] (dispose_list+0x30/0x40)
(dispose_list+0x30/0x40) from [<c022924c>] (evict_inodes+0xc8/0xd0)
(evict_inodes+0xc8/0xd0) from [<c0212964>] (generic_shutdown_super+0x44/0xc4)
(generic_shutdown_super+0x44/0xc4) from [<c0212bd4>] (kill_block_super+0x18/0x68)
(kill_block_super+0x18/0x68) from [<c0212f3c>] (deactivate_locked_super+0x48/0x64)
(deactivate_locked_super+0x48/0x64) from [<c022d660>] (SyS_umount+0x90/0x390)

Change-Id: I0a9caebeceda503c72e365957b1bf97d74f3de89
Signed-off-by: Jaegeuk Kim <jaegeuk@motorola.com>
Signed-off-by: Shiyong Li <a22381@motorola.com>
Reviewed-on: https://gerrit.mot.com/1102178
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key
2017-12-12 12:34:49 -06:00
Shiyong Li 1e1a1d11ca fs/exfat: link superblock for all the buffer head
Otherwise, we can get kernel panic when handling fs_error().

Change-Id: I288ece9bdc0182b0d4cf23f1bba920d341a8f540
Signed-off-by: Jaegeuk Kim <jaegeuk@motorola.com>
Signed-off-by: Shiyong Li <a22381@motorola.com>
Reviewed-on: https://gerrit.mot.com/1102177
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key
2017-12-12 12:34:43 -06:00
Shiyong Li 982b6998ab fs/exfat: implement errors=remount-ro
This patch implements errors=remount-ro for exfat.

Port of cf4fa60 and 58ec900 on 8996 with minor change for
updated submit_io() interface in kernel 4.9.

Change-Id: Iee791a99216ecf9f710adffa681706e761f97d8f
Signed-off-by: Shiyong Li <a22381@motorola.com>
Reviewed-on: https://gerrit.mot.com/1102176
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key
2017-12-12 12:34:37 -06:00
Shiyong Li 89b6111d7d fs/exfat: build exfat lib as DLKM
Build exfat lib as exfat.ko.

Change-Id: I653e944607f0d05e6f5ff8af4743291567d824c3
Signed-off-by: Shiyong Li <a22381@motorola.com>
Reviewed-on: https://gerrit.mot.com/1102175
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key
2017-12-12 12:34:31 -06:00
Shiyong Li f61055be5c fs/exfat: import original library v1.2.9
original repo: https://github.com/dorimanx/exfat-nofuse

latest commit:
commit de4c760
Author: Yuri.Sh <dorimanx@users.noreply.github.com>
Date:   Tue Jun 20 00:56:18 2017 +0300

    Merge pull request #116 from ian-abbott/no-krel

    Makefile: remove KREL

Change-Id: I918688177815d21a3227e740ef36680f0913d4f9
Signed-off-by: Shiyong Li <a22381@motorola.com>
Reviewed-on: https://gerrit.mot.com/1102174
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key
2017-12-12 12:34:21 -06:00