`rename_file' was exported but not properly namespaced causing a
multiple definition error because `rename_file' is already defined in
fs/hostfs/hostfs_user.c:
ld: drivers/staging/exfat/exfat_core.o: in function `rename_file':
drivers/staging/exfat/exfat_core.c:2327: multiple definition of
`rename_file'; fs/hostfs/hostfs_user.o:fs/hostfs/hostfs_user.c:350:
first defined here
make: *** [Makefile:1077: vmlinux] Error 1
This error can be reproduced on ARCH=um by selecting:
CONFIG_EXFAT_FS=y
CONFIG_HOSTFS=y
Add a namespace prefix exfat_* to fix this error.
Reported-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
Cc: stable <stable@vger.kernel.org>
Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Tested-by: David Gow <davidgow@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Link: https://lore.kernel.org/r/20191204234522.42855-1-brendanhiggins@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Currently the discard code in clr_alloc_bitmap() is just dead code.
Move code around so that the discard operation is properly attempted
when enabled.
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Link: https://lore.kernel.org/r/20191205152913.GJ3276@xps-13
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix sparse warnings:
drivers/staging/exfat/exfat_core.c:2045:4: warning: symbol 'calc_checksum_1byte' was not declared. Should it be static?
drivers/staging/exfat/exfat_core.c:2080:5: warning: symbol 'calc_checksum_4byte' was not declared. Should it be static?
The two functions has no caller in tree, so remove it.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20191114140348.46088-1-yuehaibing@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Global functions called 'buf*' are a linkage editor disaster waiting to
happen. Rename our buf_* functions to exfat_buf_*
Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191112211238.156490-12-Valdis.Kletnieks@vt.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Move a few more things so we can make them static and clear exfat.h out.
At this point, pretty much everything that can be static is static.
(Note: FAT_sync(), buf_sync(), and sync_alloc_bitmap() aren't called
anyplace, but aren't static because (a) that will toss an error and
(b) they probably *should* be getting called someplace
Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191112211238.156490-11-Valdis.Kletnieks@vt.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Everything referenced in the struct fs_func exfat_fs_func is located
in that same .c file. Make them static and remove from exfat.h
Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191112211238.156490-6-Valdis.Kletnieks@vt.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The code simplification from the previous patch rendered a few more
routines unreferenced, so heave them over the side as well.
Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191112211238.156490-5-Valdis.Kletnieks@vt.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In this patch, we straighten out most of the cases where the
code was testing 'p_fs->vol_type == EXFAT' and '!= EXFAT'
There's still some ?: ops and a few places where the code
is doing checks for '.' and '..' that require looking at,
but those are future patches
Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191112211238.156490-4-Valdis.Kletnieks@vt.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Remove the top-level mount functionality, to make this driver handle
only exfat file systems.
Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191112211238.156490-2-Valdis.Kletnieks@vt.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use -ENOTEMPTY rather than -EEXIST for attempting to remove
a directory that still has files in it.
Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191112021000.42091-10-Valdis.Kletnieks@vt.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Now that we no longer use odd internal return codes, we can
heave the translation code over the side, and just pass the
error code back up the call chain.
Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191112021000.42091-9-Valdis.Kletnieks@vt.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Similar to commit 46c9a946d7 ("shmem: use monotonic time for i_generation")
we should not use the deprecated get_seconds() interface for i_generation.
prandom_u32() is the replacement used in other file systems.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191108213257.3097633-2-arnd@arndb.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The call was not releasing the mutex upon error.
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Acked-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191103180921.2844-1-dave@stgolabs.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Operators inside a multiline logical expression should be at the end
of the line not at the beginning. This patch fixes two of those cases
and remove an unnecessary parenthesis too, to comply in that way with
the preferred coding style for the linux kernel.
Suggested-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Link: https://lore.kernel.org/r/ace2cbd5e4c03751fb522e7bbd60149e7ed969ae.1572666556.git.frank@generalsoftwareinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix alignment to match open parenthesis to comply in that way with
the preferred coding style for the linux kernel. Issue found by
checkpatch.
Suggested-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Link: https://lore.kernel.org/r/fe316e694ea9c4aa370d3a8166a3680feb342682.1572666556.git.frank@generalsoftwareinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
At a slight footprint cost (24 vs 32 bytes), mutexes are more optimal
than semaphores; it's also a nicer interface for mutual exclusion,
which is why they are encouraged over binary semaphores, when possible.
There is also lockdep support.
For both f_sem and b_sem, their semantics imply traditional lock
ownership; that is, the lock owner is the same for both lock/unlock
operations and not under irq contexts (ie for trylock/unlock scenarios).
Therefore it is safe to convert.
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://lore.kernel.org/r/20191101185332.31786-1-dave@stgolabs.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
At a slight footprint cost (24 vs 32 bytes), mutexes are more optimal
than semaphores; it's also a nicer interface for mutual exclusion,
which is why they are encouraged over binary semaphores, when possible.
For both v_sem and z_sem, their semantics imply traditional lock
ownership; that is, the lock owner is the same for both lock/unlock
operations. Therefore it is safe to convert.
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Acked-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191030144916.10802-1-dave@stgolabs.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix mount failed "Cannot allocate memory".
When the memory gets fragmented, kzalloc() might fail to allocate
physically contiguous pages for the struct exfat_sb_info (its size is
about 34KiB) even the total free memory is enough.
Use kvzalloc() to solve this problem.
Reviewed-by: Ethan Wu <ethanwu@synology.com>
Signed-off-by: Jia-Ye Li <jiayeli@synology.com>
Link: https://lore.kernel.org/r/20190925083729.4653-1-jiayeli@synology.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
We've seen several incorrect patches for fs_sync() calls in the exfat driver.
Add code to the TODO that explains this isn't just a delete code and refactor,
but that actual analysis of when the filesystem should be flushed to disk
needs to be done.
Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Link: https://lore.kernel.org/r/9837.1570042895@turing-police
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>