summaryrefslogtreecommitdiff
path: root/fs/fs.c
Commit message (Collapse)AuthorAgeFilesLines
* fs: fail gracefully in get_mounted_path/get_cdev_by_mountpathAhmad Fatoum2023-05-081-0/+4
| | | | | | | | | | get_fsdevice_by_path will return NULL if no file system was mounted at location. Returned pointer was dereferenced unconditionally, potentially leading to null pointer dereference. Fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230508074612.3313870-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: stat: fix UUID printAhmad Fatoum2023-03-141-6/+3
| | | | | | cdev->uuid is an already formatted string, not a binary UUID. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2023-02-231-2/+2
|\
| * fs: remove unused members of struct statAhmad Fatoum2023-02-031-2/+2
| | | | | | | | | | | | | | | | Some members in struct stat are never written, so drop them. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20230202142512.3551195-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: align write return codes with POSIXAhmad Fatoum2023-02-031-0/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | Writing past end of a file results in a cryptic error code: barebox@board:/ cp /dev/zero /dev/mmc0.part write: Operation not permitted cp: Operation not permitted Because the cdev's truncate is not implemented and as such partition can't be increased in size. POSIX specifies EPERM as the correct return code for truncate(2) in such a situation, but for write(2) it is ENOSPC. Thus most truncate callbacks in barebox instead return ENOSPC, when according to POSIX, EPERM would have been the correct error code to propagate. Switching all truncate drivers is a bit more involved, so for now let's treat EPERM and ENOSPC instead when truncate fails to enlarge a file. Reported-by: Marco Felsch <m.felsch@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230202132734.314110-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct fs_driver_d to fs_driverSascha Hauer2023-01-101-16/+16
| | | | | | | | | Remove the meaningless '_d' suffix. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-6-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct fs_device_d to fs_deviceSascha Hauer2023-01-101-27/+27
| | | | | | | | | Remove the meaningless '_d' suffix. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-5-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct driver_d to driverSascha Hauer2023-01-101-3/+3
| | | | | | | | | | | The '_d' suffix was originally meant to distinguish barebox struct names from Linux struct names. struct driver doesn't exist in Linux, so we can rename it and remove the meaningless suffix. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-101-5/+5
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: avoid uninitialized var warningSascha Hauer2022-11-081-1/+1
| | | | | | | | | | | | | | | | | | | With gcc-12.2.1-clang-15.0.2-glibc-2.36-binutils-2.39-kernel-6.0.5-sanitized we get a warning about path.dentry being used uninitialized: fs/fs.c:1978:43: warning: 'path.dentry' may be used uninitialized -Wmaybe-uninitialized] I can't see how this can really happen. gcc seems to think that this sequence used in lookup_fast() can result in returning 0: if (IS_ERR(dentry)) return PTR_ERR(dentry); This shouldn't happen. Silence the warning by initializing 'path'. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20221107102800.3669168-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: add new stat commandAhmad Fatoum2022-10-271-1/+104
| | | | | | | | | | | | | We have a couple of commands to help with debugging the VFS: ll, devinfo, devlookup, but we lack a command that can just dump all information we have in a struct stat or struct cdev. Add stat as such a command. For most uses, it's not needed, but it can come in handy for development. The stat_print and cdev_print functions underlying it are exported, so they can called for debugging purposes. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221026063819.2355568-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/selftest'Sascha Hauer2022-10-131-0/+15
|\
| * fs: implement unreaddirAhmad Fatoum2022-10-111-0/+15
| | | | | | | | | | | | | | | | | | | | When iterating over a directory, it can be useful to put back the just read directory entry, so it can be retried at a later time. This will be needed for the EFI loader variable support. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221010061437.2085412-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: export file system detection functionalityAhmad Fatoum2022-10-051-2/+2
| | | | | | | | | | | | | | | | | | This will come in handy when using barebox as EFI loader, so give it a more generic name and export it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220930154053.752237-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: implement cdev_mount()Ahmad Fatoum2022-10-041-0/+19
|/ | | | | | | | | | | EFI loaders provide both block device and file system access to software running under it. For file system access, we will just want to get a mount if available and mount at a default location if not. Provide a helper that does just that. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220930154017.750867-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2022-09-141-15/+35
|\
| * fs: export cdev_get_linux_rootarg() for reuseAhmad Fatoum2022-08-161-15/+35
| | | | | | | | | | | | | | | | | | | | | | | | We've the root=PARTUUID=%s generation at two places: Once to populate fsdev->linux_rootarg and once to handle struct bootm_data::root_dev. In preparation for dropping the duplicate out-of-sync code in the bootm code, export the originl fs/fs.c code as cdev_get_linux_rootarg(). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220815114835.2277946-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: drop duplicate follow_managed() callAhmad Fatoum2022-09-121-10/+3
| | | | | | | | | | | | | | | | | | lookup_fast called above already calls follow_managed with the same argument, so no need to duplicate the call here. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220905095557.596891-30-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: remove never-read initializer in mount_all()Ahmad Fatoum2022-09-121-1/+1
|/ | | | | | | | | list_for_each_entry will initialize cdev for each iteration, so the initial assignment is never used, thus drop it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220905095557.596891-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Check if automount actually mounts somethingSascha Hauer2022-07-141-0/+4
| | | | | | | | | | | | | | An automount command that returns successfully but doesn't mount anything makes barebox hang as can be reproduced with: automount -d /mnt/foo true ls /mnt/foo Check if the current dentry is a mountpoint after running the automount command, otherwise return with an error from automount_mount(). Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Remove duplicate incudesAlexander Shiyan2022-06-101-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix warning fwterated by checkincludes.pl: ./net/nfs.c: libgen.h is included more than once. ./net/ifup.c: globalvar.h is included more than once. ./crypto/rsa.c: asm/types.h is included more than once. ./lib/decompress_unlz4.c: linux/decompress/mm.h is included more than once. ./scripts/stb_image.h: stdio.h is included more than once. ./scripts/kwbimage.c: unistd.h is included more than once. ./scripts/common.c: sys/types.h is included more than once. ./scripts/bareboximd.c: sys/types.h is included more than once. ./scripts/bareboximd.c: sys/mman.h is included more than once. ./fs/pstore/ram_core.c: linux/rslib.h is included more than once. ./fs/pstore/fs.c: fs.h is included more than once. ./fs/pstore/fs.c: linux/pstore.h is included more than once. ./fs/nfs.c: fs.h is included more than once. ./fs/uimagefs.c: fs.h is included more than once. ./fs/fs.c: command.h is included more than once. ./arch/sandbox/board/hostfile.c: linux/err.h is included more than once. ./arch/sandbox/board/devices.c: mach/linux.h is included more than once. ./arch/sandbox/os/common.c: signal.h is included more than once. ./arch/arm/boards/zii-imx51-rdu1/board.c: envfs.h is included more than once. ./arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c: generated/mach-types.h is ./arch/arm/mach-stm32mp/ddrctrl.c: mach/stm32.h is included more than once. ./arch/arm/mach-imx/cpu_init.c: common.h is included more than once. ./arch/arm/mach-imx/imx8m.c: mach/imx8m-ccm-regs.h is included more than once. ./common/efi/payload/init.c: efi.h is included more than once. ./common/state/backend_format_raw.c: common.h is included more than once. ./common/state/backend_format_raw.c: crc.h is included more than once. ./common/hush.c: libbb.h is included more than once. ./drivers/spi/atmel-quadspi.c: linux/clk.h is included more than once. ./drivers/spi/atmel-quadspi.c: linux/err.h is included more than once. ./drivers/net/virtio.c: net.h is included more than once. ./drivers/net/phy/phy.c: linux/phy.h is included more than once. ./drivers/net/cpsw.c: net.h is included more than once. ./drivers/virtio/virtio_pci_common.h: linux/list.h is included more than once. ./drivers/usb/host/ohci-hcd.c: dma.h is included more than once. ./drivers/usb/gadget/fsl_udc.c: dma.h is included more than once. ./drivers/nvmem/eeprom_93xx46.c: spi/spi.h is included more than once. ./drivers/nvmem/eeprom_93xx46.c: of.h is included more than once. ./drivers/video/imx-ipu-v3/imx-ldb.c: linux/clk.h is included more than once. ./drivers/video/imx-ipu-v3/imx-hdmi.c: linux/clk.h is included more than once. ./drivers/video/omap.c: common.h is included more than once. ./drivers/mtd/nand/nand_s3c24xx.c: asm/sections.h is included more than once. ./drivers/clk/imx/clk-imx6sx.c: linux/clk.h is included more than once. ./drivers/clk/imx/clk-imx6sl.c: linux/clk.h is included more than once. ./commands/bootm.c: of.h is included more than once. Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com> Link: https://lore.barebox.org/20220607051957.2497-1-eagle.alexander923@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/efi'Sascha Hauer2022-02-181-4/+4
|\
| * rename cdev_open() -> cdev_open_by_name()Sascha Hauer2022-02-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The cdev_* functions normally take a struct cdev * argument, with the exception of cdev_open(). Rename cdev_open() to cdev_open_by_name() to be able to implement cdev_open() with the expected semantics in the next step. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220207094953.949868-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * cdev: rename partuuid to uuidMichael Olbrich2022-02-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | Partitions are not the only devices that can have UUIDs. Change the name to something more generic to prepare for other users. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Link: https://lore.barebox.org/20220124100458.2924679-2-m.olbrich@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220207094953.949868-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: add missing command groupsAhmad Fatoum2022-01-261-0/+2
|/ | | | | | | | | CMD_GRP_MISC is assumed in absence of an explicit group. Let's be explicit instead to silence the warnings during documentation build. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220124151827.3313412-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: implement pushd/popd chdir wrappersAhmad Fatoum2022-01-121-0/+30
| | | | | | | | | | | We don't have dirfd's, so running operations relative to the current working directory always involves some allocation/freeing boilerplate. Add pushd/popd helpers to move the boilerplate out of the callsites. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220108171555.588426-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: remove useless AT_FDCWD referencesAhmad Fatoum2021-11-251-29/+27
| | | | | | | | | | All name lookups by barebox are AT_FDCWD and there are no dirfd support that could be used in its place, so just remove that parameter altogether from the FS functions. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211122084732.2597109-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: remove unused struct fs_device_d::parent_deviceAhmad Fatoum2021-10-051-1/+0
| | | | | | | | The parent_device member is unused anywhere, so drop it. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20210913083019.364599-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: fix NULL pointer dereference of fsdrv->truncate for read-only FSAhmad Fatoum2021-07-091-6/+10
| | | | | | | | | | | | | | fsdrv->truncate is dereferenced at times without checking for NULL before, leading to crashes, e.g. doing: edit -o /mnt/myext4/FILE some text on ext4 crashes. Fix this by returning -EROFS when truncate is unimplemented. Reported-by: Xogium <contact@xogium.me> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20210707065251.760827-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb-gadget'Sascha Hauer2021-05-171-3/+3
|\
| * fs: error out when writing on read-only file systemAhmad Fatoum2021-05-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On an ext4 partition, Running echo -a /mnt/disk0.0/file test will crash barebox because fsdrv->truncate in __write is NULL. Don't let it come to this and verify earlier that the FS implements ->write. While at it, explicitly compare with O_RDONLY (== 0) for clarity. Fixes: b3fbfad7aeaf ("fs: dentry cache implementation") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-17-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mci'Sascha Hauer2021-05-171-4/+39
|\ \
| * | fs: add linux_rootarg 'root=mmcblkXpN' supportMarco Felsch2021-05-121-4/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit fa2d0aa96941 ("mmc: core: Allow setting slot index via device tree alias") the linux kernel supports stable mmc device names. Barebox has stable names since years so now we can connect both which allows us to pass 'root=mmcblkXpN' as argument for the cmdline. Note: it is crucial that the kernel device tree and the barebox device tree uses the same mmc aliases. This patch adds the support to store the above cmdline as linux_rootarg if enabled. The partuuid is now used as fallback since it is not as unique as the mmcblkXpN scheme. It is added as build option since the system integrator needs to check if the used kernel contains the above commit. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20210510102523.7147-3-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | fs: check getname() return value in open()Sascha Hauer2021-05-071-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | getname() can return an error when for example the input path is an empty string. Check the getname() return value in open() before further using it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | fs: check for valid name in filename_lookup()Sascha Hauer2021-05-071-0/+3
| | | | | | | | | | | | | | | | | | | | | The getname() return value is passed to filename_lookup() without checking the return value, so this must be done in filename_lookup(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | fs: check for empty name in getname()Sascha Hauer2021-05-071-2/+5
|/ / | | | | | | | | | | | | getname() should return an error for an empty path. While at it, change getname() to return an error pointer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: Fix link_path_walk to return -ENOENT on empty pathJules Maselbas2021-05-031-0/+2
|/ | | | | | | | | | | | | | | link_path_walk was returning 0 when passed with an empty path, this lead calling code to assume that the struct nameidata nd is valid and thus has a `last` field populated, which is not. In the end causing a runtime crash. This issue can easily be reproduced by running the command: cat "" Reported-by: Neeraj Pal <neerajpal09@gmail.com> Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Link: https://lore.barebox.org/20210417233409.637-1-jmaselbas@kalray.eu Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Fix default mount when device already mountedStefan Riedmueller2021-03-171-9/+19
| | | | | | | | | | | | | | | Let cdev_mount_default return an error in case the device is already mounted to a different location than the default mount point. Otherwise the automount routine can get stuck in an infinite loop spamming: mounted /dev/mmc0.0 on /mnt/mmc mounted /dev/mmc0.0 on /mnt/mmc mounted /dev/mmc0.0 on /mnt/mmc Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: delete unused members in <linux/stat.h>Ahmad Fatoum2021-03-161-1/+0
| | | | | | | | Most of the struct is stuff we don't use and likely won't any time soon. Drop them. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: increase reference count for backing store when loop mountingAhmad Fatoum2021-02-161-6/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The VFS layer already increase the mount reference count for the mount point. This means e.g. following sequence is well-behaving: mkdir -p /mnt/disk0.0/media mount -o loop backing.squashfs /mnt/disk0.0/media umount /mnt/disk0.0 barebox will do the right thing and report umount: Device or resource busy However the reference count of the file where backing.squashfs comes from is not incremented on mount with the effect that following sequence crashes: mkdir -p /media mount -o loop /mnt/disk0.0/backing.squashfs /media umount /mnt/disk0.0 # should've returned EBUSY umount /media Fix this by touching the backing store's mount reference count when loop mounting and unmounting. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: introduce unsetenv() to prepare for changing setenv(var, "") behaviorAhmad Fatoum2020-11-231-1/+1
| | | | | | | | | | | | | | | | | Currently, we treat setenv(var, "") and setenv(var, NULL) the same and delete var, which is surprising and leads to subtle quirks: - setenv(var, "") is specified by POSIX to set var to an empty string, but barebox uses it to delete variables - nv.user= calls nv_set with NULL parameter, but nv user="" doesn't Make the API more POSIX-like by providing unsetenv with the expected semantics. Most user code can then use unsetenv without worrying about whether "" or NULL is the magic deletion value. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net' into masterSascha Hauer2020-09-251-0/+34
|\
| * fs: Warn when filesystem operations are called from a pollerSascha Hauer2020-08-191-0/+34
| | | | | | | | | | | | | | | | | | Filesystem operations possibly call into arbitrary devices, so shouldn't be used from a poller. This patch sprinkles some WARN_ONCE() when this happens. One exception is when the file which is accessed is on ramfs which doesn't have any dependencies to devices. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: Fix use after freeSascha Hauer2020-09-141-3/+3
| | | | | | | | | | | | | | | | | | | | In case of the fs mounted to '/' the root dentry of the mounted filesystem is the place where it's mounted itself, so sb->s_root is the same as fsdev->vfsmount.mountpoint. In that case make sure we only access it before it has been killed in dentry_delete_subtree(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: Drop unnecessary dput()Sascha Hauer2020-09-141-1/+0
| | | | | | | | | | | | | | Calling dput() on the root dentry during unmount time is unnecessary, the dentry will be removed later in dentry_delete_subtree() anyway. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: don't free device in remove callbackAhmad Fatoum2020-09-141-2/+9
|/ | | | | | | | | | | The probe doesn't allocate the device, so remove shouldn't free it either. This fixes a use-after-free on barebox shutdown: Iterating over the list of devices requires that remove callbacks don't remove the devices. This happened to work so far, because apparently not much new allocations are going on during barebox shutdown, but let's do it right. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
* fs: free inodes we no longer needSascha Hauer2020-07-051-3/+5
| | | | | | | | So far we freed the no longer needed inodes only at unmount time. Let's trust our reference counting a bit more and free them once the reference counter hits zero. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Make iput() accept NULL pointersSascha Hauer2020-07-051-0/+3
| | | | | | | Let iput() accept NULL pointers so that users do not have to test for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2020-05-141-3/+0
|\
| * treewide: remove references to CREDITSUwe Kleine-König2020-04-271-3/+0
| | | | | | | | | | | | | | | | The CREDITS file was removed from barebox in 2015 by commit 6570288f2d97 ("Remove the CREDITS file"). Remove references to it from several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>