Anatol Pomozov [Tue, 18 Sep 2012 17:38:59 +0000 (13:38 -0400)]
ext4: make orphan functions be no-op in no-journal mode
Instead of checking whether the handle is valid, we check if journal
is enabled. This avoids taking the s_orphan_lock mutex in all cases
when there is no journal in use, including the error paths where
ext4_orphan_del() is called with a handle set to NULL.
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Conflicts:
fs/ext4/namei.c
Change-Id: I734ccb8069fceb12b864e7b9dceb37e27ab94c61
Sasha Levin [Thu, 29 Jan 2015 02:30:43 +0000 (20:30 -0600)]
vfs: read file_handle only once in handle_to_path
We used to read file_handle twice. Once to get the amount of extra bytes, and
once to fetch the entire structure.
This may be problematic since we do size verifications only after the first
read, so if the number of extra bytes changes in userspace between the first
and second calls, we'll have an incoherent view of file_handle.
Instead, read the constant size once, and copy that over to the final
structure without having to re-read it again.
Change-Id: Ib05e5129629e27d5a05953098c5bc470fae40d2a
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Apavayan Sinha [Sun, 24 Jul 2016 09:34:53 +0000 (15:04 +0530)]
tools: Remove Gator deamon
Christopher N. Hesse [Sat, 30 Jul 2016 20:00:05 +0000 (22:00 +0200)]
gpu: arm: r15p0/r12p0: fix compilation without MALI_EXYNOS_TRACE
Change-Id: Iba1d6d5929a1511b021ed2a25267d2af582dbdde
Stricted [Sat, 31 Mar 2018 22:55:46 +0000 (00:55 +0200)]
disable maybe-uninitialized warnings
Daniel Rosenberg [Wed, 28 Dec 2016 00:36:40 +0000 (16:36 -0800)]
ANDROID: vfs: Missed updating truncate to truncate2
Bug:
30954918
Change-Id: I8163d3f86dd7aadb2ab3fc11816754f331986f05
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Wed, 21 Feb 2018 04:25:45 +0000 (20:25 -0800)]
ANDROID: sdcardfs: Hold i_mutex for i_size_write
When we call i_size_write, we must be holding i_mutex to avoid
possible lockups on 32 bit/SMP architectures. This is not
necessary on 64 bit architectures.
Change-Id: Ic3b946507c54d81b5c9046f9b57d25d4b0f9feef
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
73287721
Ritesh Harjani [Mon, 4 Dec 2017 04:21:07 +0000 (09:51 +0530)]
ANDROID: sdcardfs: Set num in extension_details during make_item
Without this patch when you delete an extension from configfs
it still exists in the hash table data structures and we are
unable to delete it or change it's group.
This happens because during deletion the key & value is taken from
extension_details, and was not properly set.
Fix it by this patch.
Change-Id: I7c20cb1ab4d99e6aceadcb5ef850f0bb47f18be8
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
73055997
Daniel Rosenberg [Fri, 2 Feb 2018 00:52:22 +0000 (16:52 -0800)]
ANDROID: sdcardfs: Protect set_top
If the top is changed while we're attempting to use it, it's
possible that the reference will be put while we are in the
process of grabbing a reference.
Now we grab a spinlock to protect grabbing our reference count.
Additionally, we now set the inode_info's top value to point to
it's own data when initializing, which makes tracking changes
easier.
Change-Id: If15748c786ce4c0480ab8c5051a92523aff284d2
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Wed, 24 Jan 2018 01:51:26 +0000 (17:51 -0800)]
Revert "ANDROID: sdcardfs: notify lower file of opens"
This reverts commit
f18c44dc552e2ed0655ed5ec49b578da4dd30588.
Instead of calling notify within sdcardfs, which reverse the
order of notifications during an open with truncate, we'll
make fs_notify worry about it.
Change-Id: Ic634401c0f223500066300a4df8b1453a0b35b60
Bug:
70706497
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Tue, 30 Jan 2018 05:31:21 +0000 (21:31 -0800)]
ANDROID: sdcardfs: Use lower getattr times/size
We now use the lower filesystem's getattr for time and size related
information.
Change-Id: I3dd05614a0c2837a13eeb033444fbdf070ddce2a
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
72007585
Daniel Rosenberg [Tue, 23 Jan 2018 22:34:38 +0000 (14:34 -0800)]
ANDROID: xattr: Pass EOPNOTSUPP to permission2
The permission call for xattr operations happens regardless of
whether or not the xattr functions are implemented.
The xattr functions currently don't have support for permission2.
Passing EOPNOTSUPP as the mount point in xattr_permission allows
us to return EOPNOTSUPP early in permission2, if the filesystem
supports it.
Change-Id: I9d07e4cd633cf40af60450ffbff7ac5c1b4e8c2c
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35848445
Daniel Rosenberg [Fri, 19 Jan 2018 00:17:16 +0000 (16:17 -0800)]
ANDROID: sdcardfs: Move default_normal to superblock
Moving default_normal from mount info to superblock info
as it doesn't need to change between mount points.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
72158116
Change-Id: I16c6a0577c601b4f7566269f7e189fcf697afd4e
Daniel Rosenberg [Mon, 8 Jan 2018 21:57:36 +0000 (13:57 -0800)]
ANDROID: sdcardfs: Fix missing break on default_normal
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
64672411
Change-Id: I98796df95dc9846adb77a11f49a1a254fb1618b1
Daniel Rosenberg [Tue, 2 Jan 2018 22:44:49 +0000 (14:44 -0800)]
ANDROID: sdcardfs: Add default_normal option
The default_normal option causes mounts with the gid set to
AID_SDCARD_RW to have user specific gids, as in the normal case.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I9619b8ac55f41415df943484dc8db1ea986cef6f
Bug:
64672411
Daniel Rosenberg [Thu, 21 Dec 2017 00:59:11 +0000 (16:59 -0800)]
ANDROID: sdcardfs: notify lower file of opens
fsnotify_open is not called within dentry_open,
so we need to call it ourselves.
Change-Id: Ia7f323b3d615e6ca5574e114e8a5d7973fb4c119
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
70706497
Daniel Rosenberg [Sat, 9 Sep 2017 00:20:06 +0000 (17:20 -0700)]
ANDROID: sdcardfs: Add missing break
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
63245673
Change-Id: I5fc596420301045895e5a9a7e297fd05434babf9
Daniel Rosenberg [Thu, 20 Jul 2017 00:25:07 +0000 (17:25 -0700)]
ANDROID: Sdcardfs: Move gid derivation under flag
This moves the code to adjust the gid/uid of lower filesystem
files under the mount flag derive_gid.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I44eaad4ef67c7fcfda3b6ea3502afab94442610c
Bug:
63245673
Andrew Chant [Wed, 8 Feb 2017 23:33:48 +0000 (15:33 -0800)]
sdcardfs: limit stacking depth
Limit filesystem stacking to prevent stack overflow.
Bug:
32761463
Change-Id: I8b1462b9c0d6c7f00cf110724ffb17e7f307c51e
Signed-off-by: Andrew Chant <achant@google.com>
Jaegeuk Kim [Fri, 7 Jul 2017 02:12:22 +0000 (19:12 -0700)]
ANDROID: sdcardfs: override credential for ioctl to lower fs
Otherwise, lower_fs->ioctl() fails due to inode_owner_or_capable().
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Bug:
63260873
Change-Id: I623a6c7c5f8a3cbd7ec73ef89e18ddb093c43805
Nathan Chancellor [Sat, 5 Nov 2016 09:42:21 +0000 (02:42 -0700)]
sdcardfs: change d_u.d_child to d_child
d_u.d_child was switched to just d_child in commit "move d_rcu from overlapping d_child to overlapping d_alias"
Change-Id: I18d6f2fcc0bb93092e82a50dc11193115298ba45
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Daniel Rosenberg [Thu, 20 Jul 2017 00:16:43 +0000 (17:16 -0700)]
ANDROID: sdcardfs: Remove unnecessary lock
The mmap_sem lock does not appear to be protecting
anything, and has been removed in Samsung's more
recent versions of sdcardfs.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I76ff3e33002716b8384fc8be368028ed63dffe4e
Bug:
63785372
Gao Xiang [Tue, 9 May 2017 04:30:56 +0000 (12:30 +0800)]
ANDROID: sdcardfs: use mount_nodev and fix a issue in sdcardfs_kill_sb
Use the VFS mount_nodev instead of customized mount_nodev_with_options
and fix generic_shutdown_super to kill_anon_super because of set_anon_super
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Change-Id: Ibe46647aa2ce49d79291aa9d0295e9625cfccd80
Greg Hackmann [Tue, 16 May 2017 23:48:49 +0000 (16:48 -0700)]
ANDROID: sdcardfs: remove dead function open_flags_to_access_mode()
smatch warns about the suspicious formatting in the last line of
open_flags_to_access_mode(). It turns out the only caller was deleted
over a year ago by "ANDROID: sdcardfs: Bring up to date with Android M
permissions:", so we can "fix" the function's formatting by deleting it.
Change-Id: Id85946f3eb01722eef35b1815f405a6fda3aa4ff
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Daniel Rosenberg [Wed, 7 Jun 2017 19:44:50 +0000 (12:44 -0700)]
ANDROID: sdcardfs: d_splice_alias can return error values
We must check that d_splice_alias was successful before using its
output.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
62390017
Change-Id: Ifda0a052fb3f67e35c635a4e5e907876c5400978
Daniel Rosenberg [Mon, 22 May 2017 20:23:56 +0000 (13:23 -0700)]
ANDROID: sdcardfs: Check for NULL in revalidate
If the inode is in the process of being evicted,
the top value may be NULL.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
38502532
Change-Id: I0b9d04aab621e0398d44d1c5dc53293106aa5f89
Dmitry Shmidt [Wed, 17 May 2017 20:05:20 +0000 (13:05 -0700)]
ANDROID: sdcardfs: Add linux/kref.h include
Change-Id: I8be0f6fc7aa6dc1d639d2d22b230783c68574389
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Daniel Rosenberg [Mon, 15 May 2017 21:03:15 +0000 (14:03 -0700)]
ANDROID: sdcardfs: Move top to its own struct
Move top, and the associated data, to its own struct.
This way, we can properly track refcounts on top
without interfering with the inode's accounting.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
38045152
Change-Id: I1968e480d966c3f234800b72e43670ca11e1d3fd
Conflicts:
fs/sdcardfs/super.c
Gao Xiang [Wed, 10 May 2017 15:01:15 +0000 (23:01 +0800)]
ANDROID: sdcardfs: fix sdcardfs_destroy_inode for the inode RCU approach
According to the following commits,
fs: icache RCU free inodes
vfs: fix the stupidity with i_dentry in inode destructors
sdcardfs_destroy_inode should be fixed for the fast path safety.
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Change-Id: I84f43c599209d23737c7e28b499dd121cb43636d
Daniel Roseberg [Tue, 9 May 2017 20:36:35 +0000 (13:36 -0700)]
ANDROID: sdcardfs: Don't iput if we didn't igrab
If we fail to get top, top is either NULL, or igrab found
that we're in the process of freeing that inode, and did
not grab it. Either way, we didn't grab it, and have no
business putting it.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
38117720
Change-Id: Ie2f587483b9abb5144263156a443e89bc69b767b
Daniel Rosenberg [Tue, 25 Apr 2017 02:49:02 +0000 (19:49 -0700)]
ANDROID: sdcardfs: Call lower fs's revalidate
We should be calling the lower filesystem's revalidate
inside of sdcardfs's revalidate, as wrapfs does.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35766959
Change-Id: I939d1c4192fafc1e21678aeab43fe3d588b8e2f4
Daniel Rosenberg [Mon, 24 Apr 2017 23:11:03 +0000 (16:11 -0700)]
ANDROID: sdcardfs: Avoid setting GIDs outside of valid ranges
When setting up the ownership of files on the lower filesystem,
ensure that these values are in reasonable ranges for apps. If
they aren't, default to AID_MEDIA_RW
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
37516160
Change-Id: I0bec76a61ac72aff0b993ab1ad04be8382178a00
Daniel Rosenberg [Thu, 20 Apr 2017 19:00:30 +0000 (12:00 -0700)]
Revert "Android: sdcardfs: Don't do d_add for lower fs"
This reverts commit
60df9f12992bc067216078ae756066c5d7c74d87.
This change caused issues for sdcardfs on top of vfat
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: Ie56a91fda582af27921cc1a9de7ae19a9a988f2a
Daniel Rosenberg [Wed, 19 Apr 2017 05:49:38 +0000 (22:49 -0700)]
Android: sdcardfs: Don't complain in fixup_lower_ownership
Not all filesystems support changing the owner of a file.
We shouldn't complain if it doesn't happen.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
37488099
Change-Id: I403e44ab7230f176e6df82f6adb4e5c82ce57f33
Daniel Rosenberg [Wed, 19 Apr 2017 05:25:15 +0000 (22:25 -0700)]
Android: sdcardfs: Don't do d_add for lower fs
For file based encryption, ext4 explicitly does not
create negative dentries for encrypted files. If you
force one over it, the decrypted file will be hidden
until the cache is cleared. Instead, just fail out.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
37231161
Change-Id: Id2a9708dfa75e1c22f89915c529789caadd2ca4b
Daniel Rosenberg [Tue, 18 Apr 2017 19:45:48 +0000 (12:45 -0700)]
ANDROID: sdcardfs: ->iget fixes
Adapted from wrapfs
commit 8c49eaa0sb9c ("Wrapfs: ->iget fixes")
Change where we igrab/iput to ensure we always hold a valid lower_inode.
Return ENOMEM (not EACCES) if iget5_locked returns NULL.
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35766959
Change-Id: Id8d4e0c0cbc685a0a77685ce73c923e9a3ddc094
Daniel Rosenberg [Tue, 18 Apr 2017 00:11:38 +0000 (17:11 -0700)]
Android: sdcardfs: Change cache GID value
Change-Id: Ieb955dd26493da26a458bc20fbbe75bca32b094f
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
37193650
Daniel Rosenberg [Tue, 11 Apr 2017 03:54:30 +0000 (20:54 -0700)]
ANDROID: sdcardfs: Directly pass lower file for mmap
Instead of relying on a copy hack, pass the lower file
as private data. This lets the kernel find the vma
mapping for pages used by the file, allowing pages
used by mapping to be reclaimed.
This is adapted from following esdfs patches
commit
0647e638d: ("esdfs: store lower file in vm_file for mmap")
commit
064850866: ("esdfs: keep a counter for mmaped file")
Change-Id: I75b74d1e5061db1b8c13be38d184e118c0851a1a
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Fri, 10 Mar 2017 04:56:05 +0000 (20:56 -0800)]
ANDROID: sdcardfs: update module info
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I958c7c226d4e9265fea8996803e5b004fb33d8ad
Daniel Rosenberg [Fri, 10 Mar 2017 06:11:08 +0000 (22:11 -0800)]
ANDROID: sdcardfs: use d_splice_alias
adapted from wrapfs
commit
9671770ff8b9 ("Wrapfs: use d_splice_alias")
Refactor interpose code to allow lookup to use d_splice_alias.
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35766959
Change-Id: Icf51db8658202c48456724275b03dc77f73f585b
Daniel Rosenberg [Fri, 10 Mar 2017 05:42:01 +0000 (21:42 -0800)]
ANDROID: sdcardfs: fix ->llseek to update upper and lower offset
Adapted from wrapfs
commit
1d1d23a47baa ("Wrapfs: fix ->llseek to update upper and lower
offsets")
Fixes bug: xfstests generic/257. f_pos consistently is required by and
only by dir_ops->wrapfs_readdir, main_ops is not affected.
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Mengyang Li <li.mengyang@stonybrook.edu>
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35766959
Change-Id: I360a1368ac37ea8966910a58972b81504031d437
Conflicts:
fs/sdcardfs/file.c
Daniel Rosenberg [Fri, 10 Mar 2017 05:24:58 +0000 (21:24 -0800)]
ANDROID: sdcardfs: copy lower inode attributes in ->ioctl
Adapted from wrapfs
commit
fbc9c6f83ea6 ("Wrapfs: copy lower inode attributes in ->ioctl")
commit
e97d8e26cc9e ("Wrapfs: use file_inode helper")
Some ioctls (e.g., EXT2_IOC_SETFLAGS) can change inode attributes, so copy
them from lower inode.
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35766959
Change-Id: I0f12684b9dbd4088b4a622c7ea9c03087f40e572
Daniel Rosenberg [Fri, 10 Mar 2017 05:14:45 +0000 (21:14 -0800)]
ANDROID: sdcardfs: remove unnecessary call to do_munmap
Adapted from wrapfs
commit
5be6de9ecf02 ("Wrapfs: use vm_munmap in ->mmap")
commit
2c9f6014a8bb ("Wrapfs: remove unnecessary call
to vm_unmap in ->mmap")
Code is unnecessary and causes deadlocks in newer kernels.
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35766959
Change-Id: Ia252d60c60799d7e28fc5f1f0f5b5ec2430a2379
Daniel Rosenberg [Wed, 22 Mar 2017 02:11:38 +0000 (19:11 -0700)]
ANDROID: sdcardfs: Fix style issues in macros
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35331000
Change-Id: I89c4035029dc2236081a7685c55cac595d9e7ebf
Daniel Rosenberg [Wed, 22 Mar 2017 00:27:40 +0000 (17:27 -0700)]
ANDROID: sdcardfs: Use seq_puts over seq_printf
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35331000
Change-Id: I3795ec61ce61e324738815b1ce3b0e09b25d723f
Daniel Rosenberg [Fri, 17 Mar 2017 02:32:59 +0000 (19:32 -0700)]
ANDROID: sdcardfs: Use to kstrout
Switch from deprecated simple_strtoul to kstrout
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35331000
Change-Id: If18bd133b4d2877f71e58b58fc31371ff6613ed5
Daniel Rosenberg [Fri, 17 Mar 2017 00:46:13 +0000 (17:46 -0700)]
ANDROID: sdcardfs: Use pr_[...] instead of printk
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35331000
Change-Id: Ibc635ec865750530d32b87067779f681fe58a003
Daniel Rosenberg [Tue, 21 Mar 2017 23:29:13 +0000 (16:29 -0700)]
ANDROID: sdcardfs: remove unneeded null check
As pointed out by checkpatch, these functions already
handle null inputs, so the checks are not needed.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35331000
Change-Id: I189342f032dfcefee36b27648bb512488ad61d20
Daniel Rosenberg [Fri, 17 Mar 2017 02:33:35 +0000 (19:33 -0700)]
ANDROID: sdcardfs: Fix style issues with comments
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35331000
Change-Id: I8791ef7eac527645ecb9407908e7e5ece35b8f80
Daniel Rosenberg [Fri, 17 Mar 2017 00:42:58 +0000 (17:42 -0700)]
ANDROID: sdcardfs: Fix formatting
This fixes various spacing and bracket related issues
pointed out by checkpatch.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35331000
Change-Id: I6e248833a7a04e3899f3ae9462d765cfcaa70c96
Daniel Rosenberg [Tue, 21 Mar 2017 23:28:27 +0000 (16:28 -0700)]
ANDROID: sdcardfs: correct order of descriptors
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35331000
Change-Id: Ia6d16b19c8c911f41231d2a12be0740057edfacf
Daniel Rosenberg [Mon, 13 Mar 2017 22:34:03 +0000 (15:34 -0700)]
ANDROID: sdcardfs: Fix gid issue
We were already calculating most of these values,
and erroring out because the check was confused by this.
Instead of recalculating, adjust it as needed.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
36160015
Change-Id: I9caf3e2fd32ca2e37ff8ed71b1d392f1761bc9a9
Daniel Rosenberg [Mon, 13 Mar 2017 20:53:54 +0000 (13:53 -0700)]
ANDROID: sdcardfs: Use tabs instead of spaces in multiuser.h
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35331000
Change-Id: Ic7801914a7dd377e270647f81070020e1f0bab9b
Daniel Rosenberg [Sat, 11 Mar 2017 02:58:25 +0000 (18:58 -0800)]
ANDROID: sdcardfs: Remove uninformative prints
At best these prints do not provide useful information, and
at worst, some allow userspace to abuse the kernel log.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
36138424
Change-Id: I812c57cc6a22b37262935ab77f48f3af4c36827e
Daniel Rosenberg [Fri, 10 Mar 2017 21:54:30 +0000 (13:54 -0800)]
ANDROID: sdcardfs: move path_put outside of spinlock
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35643557
Change-Id: Ib279ebd7dd4e5884d184d67696a93e34993bc1ef
Daniel Rosenberg [Fri, 10 Mar 2017 20:39:42 +0000 (12:39 -0800)]
ANDROID: sdcardfs: Use case insensitive hash function
Case insensitive comparisons don't help us much if
we hash to different buckets...
Signed-off-by: Daniel Rosenberg <drosen@google.com>
bug:
36004503
Change-Id: I91e00dbcd860a709cbd4f7fd7fc6d855779f3285
Daniel Rosenberg [Fri, 10 Mar 2017 04:59:18 +0000 (20:59 -0800)]
ANDROID: sdcardfs: declare MODULE_ALIAS_FS
From commit
ee616b78aa87 ("Wrapfs: declare MODULE_ALIAS_FS")
Signed-off-by: Daniel Rosenberg <drosen@google.com>
bug:
35766959
Change-Id: Ia4728ab49d065b1d2eb27825046f14b97c328cba
Daniel Rosenberg [Fri, 10 Mar 2017 02:12:16 +0000 (18:12 -0800)]
ANDROID: sdcardfs: Get the blocksize from the lower fs
This changes sdcardfs to be more in line with the
getattr in wrapfs, which calls the lower fs's getattr
to get the block size
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
34723223
Change-Id: I1c9e16604ba580a8cdefa17f02dcc489d7351aed
Daniel Rosenberg [Thu, 9 Mar 2017 01:45:46 +0000 (17:45 -0800)]
ANDROID: sdcardfs: Use d_invalidate instead of drop_recurisve
drop_recursive did not properly remove stale dentries.
Instead, we use the vfs's d_invalidate, which does the proper cleanup.
Additionally, remove the no longer used drop_recursive, and
fixup_top_recursive that that are no longer used.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: Ibff61b0c34b725b024a050169047a415bc90f0d8
Daniel Rosenberg [Thu, 9 Mar 2017 01:20:02 +0000 (17:20 -0800)]
ANDROID: sdcardfs: Switch to internal case insensitive compare
There were still a few places where we called into a case
insensitive lookup that was not defined by sdcardfs.
Moving them all to the same place will allow us to switch
the implementation in the future.
Additionally, the check in fixup_perms_recursive did not
take into account the length of both strings, causing
extraneous matches when the name we were looking for was
a prefix of the child name.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I45ce768cd782cb4ea1ae183772781387c590ecc2
Daniel Rosenberg [Thu, 9 Mar 2017 01:11:51 +0000 (17:11 -0800)]
ANDROID: sdcardfs: Use spin_lock_nested
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
36007653
Change-Id: I805d5afec797669679853fb2bb993ee38e6276e4
Daniel Rosenberg [Thu, 2 Mar 2017 23:11:27 +0000 (15:11 -0800)]
ANDROID: sdcardfs: Replace get/put with d_lock
dput cannot be called with a spin_lock. Instead,
we protect our accesses by holding the d_lock.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35643557
Change-Id: I22cf30856d75b5616cbb0c223724f5ab866b5114
Daniel Rosenberg [Fri, 3 Mar 2017 02:07:21 +0000 (18:07 -0800)]
ANDROID: sdcardfs: rate limit warning print
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35848445
Change-Id: Ida72ea0ece191b2ae4a8babae096b2451eb563f6
Daniel Rosenberg [Thu, 2 Mar 2017 01:04:41 +0000 (17:04 -0800)]
ANDROID: sdcardfs: Fix case insensitive lookup
The previous case insensitive lookup relied on the
entry being present in the dcache. This instead uses
iterate_dir to find the correct case.
Signed-off-by: Daniel Rosenberg <drosen@google.com
bug:
35633782
Change-Id: I556f7090773468c1943c89a5e2aa07f746ba49c5
alexax66 [Sat, 9 Sep 2017 13:07:13 +0000 (13:07 +0000)]
Revert "sdcardfs: limit stacking depth"
This reverts commit
1d9ff6b31bd797409085ddeb606d8654979be7dc.
alexax66 [Sat, 9 Sep 2017 13:04:47 +0000 (13:04 +0000)]
Revert "sdcardfs: Fix build for linux-3.10.y"
This reverts commit
86cb714606711a06109eb7c973dc585f993202c9.
Parth Bhatia [Sun, 21 May 2017 15:03:58 +0000 (15:03 +0000)]
sdcardfs: Fix build for linux-3.10.y
* Fix compilation after
6637ecd
Andrew Chant [Wed, 8 Feb 2017 23:33:48 +0000 (15:33 -0800)]
sdcardfs: limit stacking depth
Limit filesystem stacking to prevent stack overflow.
Bug:
32761463
Change-Id: I8b1462b9c0d6c7f00cf110724ffb17e7f307c51e
Signed-off-by: Andrew Chant <achant@google.com>
Daniel Rosenberg [Wed, 22 Feb 2017 22:41:58 +0000 (14:41 -0800)]
ANDROID: sdcardfs: Don't bother deleting freelist
There is no point deleting entries from dlist, as
that is a temporary list on the stack from which
contains only entries that are being deleted.
Not all code paths set up dlist, so those that
don't were performing invalid accesses in
hash_del_rcu. As an additional means to prevent
any other issue, we null out the list entries when
we allocate from the cache.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35666680
Change-Id: Ibb1e28c08c3a600c29418d39ba1c0f3db3bf31e5
Daniel Rosenberg [Fri, 17 Feb 2017 01:55:22 +0000 (17:55 -0800)]
ANDROID: sdcardfs: Add missing path_put
"ANDROID: sdcardfs: Add GID Derivation to sdcardfs" introduced
an unbalanced pat_get, leading to storage space not being freed
after deleting a file until rebooting. This adds the missing path_put.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
34691169
Change-Id: Ia7ef97ec2eca2c555cc06b235715635afc87940e
Daniel Rosenberg [Wed, 15 Feb 2017 04:47:17 +0000 (20:47 -0800)]
ANDROID: sdcardfs: Fix incorrect hash
This adds back the hash calculation removed as part of
the previous patch, as it is in fact necessary.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
35307857
Change-Id: Ie607332bcf2c5d2efdf924e4060ef3f576bf25dc
Daniel Rosenberg [Wed, 1 Feb 2017 04:07:51 +0000 (20:07 -0800)]
ANDROID: sdcardfs: Switch strcasecmp for internal call
This moves our uses of strcasecmp over to an internal call so we can
easily change implementations later if we so desire. Additionally,
we leverage qstr's where appropriate to save time on comparisons.
Change-Id: I32fdc4fd0cd3b7b735dcfd82f60a2516fd8272a5
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Sat, 28 Jan 2017 03:35:08 +0000 (19:35 -0800)]
ANDROID: sdcardfs: switch to full_name_hash and qstr
Use the kernel's string hash function instead of rolling
our own. Additionally, save a bit of calculation by using
the qstr struct in place of strings.
Change-Id: I0bbeb5ec2a9233f40135ad632e6f22c30ffa95c1
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Wed, 25 Jan 2017 21:48:45 +0000 (13:48 -0800)]
ANDROID: sdcardfs: Add GID Derivation to sdcardfs
This changes sdcardfs to modify the user and group in the
underlying filesystem depending on its usage. Ownership is
set by Android user, and package, as well as if the file is
under obb or cache. Other files can be labeled by extension.
Those values are set via the configfs interace.
To add an entry,
mkdir -p [configfs root]/sdcardfs/extensions/[gid]/[ext]
Bug:
34262585
Change-Id: I4e030ce84f094a678376349b1a96923e5076a0f4
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Fri, 27 Jan 2017 04:10:34 +0000 (20:10 -0800)]
ANDROID: sdcardfs: Remove redundant operation
We call get_derived_permission_new unconditionally, so we don't need
to call update_derived_permission_lock, which does the same thing.
Change-Id: I0748100828c6af806da807241a33bf42be614935
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Sun, 22 Jan 2017 23:32:49 +0000 (15:32 -0800)]
ANDROID: sdcardfs: add support for user permission isolation
This allows you to hide the existence of a package from
a user by adding them to an exclude list. If a user
creates that package's folder and is on the exclude list,
they will not see that package's id.
Bug:
34542611
Change-Id: I9eb82e0bf2457d7eb81ee56153b9c7d2f6646323
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Sat, 21 Jan 2017 08:35:26 +0000 (00:35 -0800)]
ANDROID: sdcardfs: Refactor configfs interface
This refactors the configfs code to be more easily extended.
It will allow additional files to be added easily.
Bug:
34542611
Bug:
34262585
Change-Id: I73c9b0ae5ca7eb27f4ebef3e6807f088b512d539
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Fri, 20 Jan 2017 23:19:13 +0000 (15:19 -0800)]
ANDROID: sdcardfs: Allow non-owners to touch
This modifies the permission checks in setattr to
allow for non-owners to modify the timestamp of
files to things other than the current time.
This still requires write access, as enforced by
the permission call, but relaxes the requirement
that the caller must be the owner, allowing those
with group permissions to change it as well.
Bug:
11118565
Change-Id: Ied31f0cce2797675c7ef179eeb4e088185adcbad
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Fri, 24 Feb 2017 23:41:48 +0000 (15:41 -0800)]
ANDROID: sdcardfs: implement vm_ops->page_mkwrite
This comes from the wrapfs patch
3dfec0ffe5e2 Wrapfs: implement vm_ops->page_mkwrite
Some file systems (e.g., ext4) require it. Reported by Ted Ts'o.
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
34133558
Change-Id: I1a389b2422c654a6d3046bb8ec3e20511aebfa8e
Daniel Rosenberg [Fri, 24 Feb 2017 23:49:45 +0000 (15:49 -0800)]
ANDROID: sdcardfs: support direct-IO (DIO) operations
This comes from the wrapfs patch
2e346c83b26e Wrapfs: support direct-IO (DIO) operations
Signed-off-by: Li Mengyang <li.mengyang@stonybrook.edu>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug:
34133558
Change-Id: I3fd779c510ab70d56b1d918f99c20421b524cdc4
fluxi [Fri, 21 Oct 2016 20:57:35 +0000 (22:57 +0200)]
sdcardfs: Flag files as non-mappable
WARNING: it's not full commit, it just update sdcardfs
Implement Samsung's FMODE_NONMAPPABLE flag from
sdcardfs version 2.1.4 as we hit a BUG on ext4:
[ 49.655037]@0 Kernel BUG at
ffffffc0001deeec [verbose debug info unavailable]
[ 49.655045]@0 Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[ 49.655052]@0 Modules linked in:
[ 49.655061]@0 CPU: 0 PID: 283 Comm: kworker/u8:7 Tainted: G W
3.18.20-perf-g3be2054-00086-ga8307fb #1
[ 49.655070]@0 Hardware name: Qualcomm Technologies, Inc. MSM 8996 v3 + PMI8996 MTP (DT)
[ 49.655077]@0 Workqueue: writeback bdi_writeback_workfn (flush-8:0)
[ 49.655096]@0 task:
ffffffc174ba8b00 ti:
ffffffc174bb4000 task.ti:
ffffffc174bb4000
[ 49.655108]@0 PC is at mpage_prepare_extent_to_map+0x198/0x218
[ 49.655116]@0 LR is at mpage_prepare_extent_to_map+0x110/0x218
[ 49.655121]@0 pc : [<
ffffffc0001deeec>] lr : [<
ffffffc0001dee64>] pstate:
60000145
[ 49.655126]@0 sp :
ffffffc174bb7800
[ 49.655130]@0 x29:
ffffffc174bb7800 x28:
ffffffc174bb7880
[ 49.655140]@0 x27:
000000000000000d x26:
ffffffc1245505e8
[ 49.655149]@0 x25:
0000000000000000 x24:
0000000000003400
[ 49.655160]@0 x23:
ffffffffffffffff x22:
0000000000000000
[ 49.655172]@0 x21:
ffffffc174bb7888 x20:
ffffffc174bb79e0
[ 49.655182]@0 x19:
ffffffbdc4ee7b80 x18:
0000007f92872000
[ 49.655191]@0 x17:
0000007f959b6424 x16:
ffffffc00016d1ac
[ 49.655201]@0 x15:
0000007f9285d158 x14:
ffffffc1734796e8
[ 49.655210]@0 x13:
ffffffbdc1ffa4c0 x12:
ffffffbdc4ee7b80
[ 49.655220]@0 x11:
0000000000000100 x10:
0000000000000000
[ 49.655229]@0 x9 :
0000000000000000 x8 :
ffffffc0b444e210
[ 49.655237]@0 x7 :
0000000000000000 x6 :
ffffffc0b444e1e0
[ 49.655246]@0 x5 :
0000000000000000 x4 :
0000000000000001
[ 49.655254]@0 x3 :
0000000000000000 x2 :
400000000002003d
[ 49.655263]@0 x1 :
ffffffbdc4ee7b80 x0 :
400000000002003d
[ 49.655271]@0
[ 49.656502]@0 Process kworker/u8:7 (pid: 283, stack limit = 0xffffffc174bb4058)
[ 49.656509]@0 Call trace:
[ 49.656514]@0 [<
ffffffc0001deeec>] mpage_prepare_extent_to_map+0x198/0x218
[ 49.656526]@0 [<
ffffffc0001e28d0>] ext4_writepages+0x270/0xa58
[ 49.656533]@0 [<
ffffffc00012982c>] do_writepages+0x24/0x40
[ 49.656541]@0 [<
ffffffc000180160>] __writeback_single_inode+0x40/0x114
[ 49.656549]@0 [<
ffffffc000180e50>] writeback_sb_inodes+0x1dc/0x34c
[ 49.656555]@0 [<
ffffffc00018103c>] __writeback_inodes_wb+0x7c/0xc4
[ 49.656560]@0 [<
ffffffc000181224>] wb_writeback+0x110/0x1a8
[ 49.656565]@0 [<
ffffffc000181344>] wb_check_old_data_flush+0x88/0x98
[ 49.656571]@0 [<
ffffffc00018156c>] bdi_writeback_workfn+0xf4/0x1fc
[ 49.656576]@0 [<
ffffffc0000b14f8>] process_one_work+0x1e0/0x300
[ 49.656585]@0 [<
ffffffc0000b1e14>] worker_thread+0x318/0x438
[ 49.656590]@0 [<
ffffffc0000b5da0>] kthread+0xe0/0xec
[ 49.656598]@0 Code:
f9400260 f9400a63 1ad92063 37580040 (
e7f001f2)
[ 49.656604]@0 ---[ end trace
cbed09f772fd630d ]---
Change-Id: I931da7cb3841db1f130dba298a7d256b6f02d1bc
Daniel Rosenberg [Tue, 27 Dec 2016 20:36:29 +0000 (12:36 -0800)]
ANDROID: sdcardfs: Fix locking issue with permision fix up
Don't use lookup_one_len so we can grab the spinlock that
protects d_subdirs.
Bug:
30954918
Change-Id: I0c6a393252db7beb467e0d563739a3a14e1b5115
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Thu, 27 Oct 2016 03:27:20 +0000 (20:27 -0700)]
sdcardfs: Use per mount permissions
This switches sdcardfs over to using permission2.
Instead of mounting several sdcardfs instances onto
the same underlaying directory, you bind mount a
single mount several times, and remount with the
options you want. These are stored in the private
mount data, allowing you to maintain the same tree,
but have different permissions for different mount
points.
Warning functions have been added for permission,
as it should never be called, and the correct
behavior is unclear.
Change-Id: I841b1d70ec60cf2b866fa48edeb74a0b0f8334f5
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Thu, 27 Oct 2016 00:36:05 +0000 (17:36 -0700)]
sdcardfs: Add gid and mask to private mount data
Adds support for mount2, remount2, and the functions
to allocate/clone/copy the private data
The next patch will switch over to actually using it.
Change-Id: I8a43da26021d33401f655f0b2784ead161c575e3
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Wed, 26 Oct 2016 23:48:45 +0000 (16:48 -0700)]
sdcardfs: User new permission2 functions
Change-Id: Ic7e0fb8fdcebb31e657b079fe02ac834c4a50db9
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Mon, 26 Sep 2016 21:48:22 +0000 (14:48 -0700)]
sdcardfs: Move directory unlock before touch
This removes a deadlock under low memory conditions.
filp_open can call lookup_slow, which will attempt to
lock the parent.
Change-Id: I940643d0793f5051d1e79a56f4da2fa8ca3d8ff7
Signed-off-by: Daniel Rosenberg <drosen@google.com>
alvin_liang [Sun, 14 May 2017 12:30:30 +0000 (12:30 +0000)]
sdcardfs: fix external storage exporting incorrect uid
Symptom: App cannot write into per-app folder
Root Cause: sdcardfs exports incorrect uid
Solution: fix uid
Project: All
Note:
Test done by RD: passed
Daniel Rosenberg [Wed, 18 May 2016 23:57:10 +0000 (16:57 -0700)]
sdcardfs: Added top to sdcardfs_inode_info
Adding packages to the package list and moving files
takes a large amount of locks, and is currently a
heavy operation. This adds a 'top' field to the
inode_info, which points to the inode for the top
most directory whose owner you would like to match.
On permission checks and get_attr, we look up the
owner based on the information at top. When we change
a package mapping, we need only modify the information
in the corresponding top inode_info's. When renaming,
we must ensure top is set correctly in all children.
This happens when an app specific folder gets moved
outside of the folder for that app.
Change-Id: Ib749c60b568e9a45a46f8ceed985c1338246ec6c
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Tue, 10 May 2016 20:42:43 +0000 (13:42 -0700)]
sdcardfs: Switch package list to RCU
Switched the package id hashmap to use RCU.
Change-Id: I9fdcab279009005bf28536247d11e13babab0b93
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Tue, 16 Aug 2016 22:19:26 +0000 (15:19 -0700)]
sdcardfs: Fix locking for permission fix up
Iterating over d_subdirs requires taking d_lock.
Removed several unneeded locks.
Change-Id: I5b1588e54c7e6ee19b756d6705171c7f829e2650
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Wed, 27 Apr 2016 22:31:29 +0000 (15:31 -0700)]
sdcardfs: Check for other cases on path lookup
This fixes a bug where the first lookup of a
file or folder created under a different view
would not be case insensitive. It will now
search through for a case insensitive match
if the initial lookup fails.
Bug:
28024488
Change-Id: I4ff9ce297b9f2f9864b47540e740fd491c545229
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Wed, 13 Apr 2016 23:38:34 +0000 (16:38 -0700)]
sdcardfs: override umask on mkdir and create
The mode on files created on the lower fs should
not be affected by the umask of the calling
task's fs_struct. Instead, we create a copy
and modify it as needed. This also lets us avoid
the string shenanigans around .nomedia files.
Bug:
27992761
Change-Id: Ia3a6e56c24c6e19b3b01c1827e46403bb71c2f4c
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Julia Lawall [Wed, 1 Jun 2016 17:28:49 +0000 (10:28 -0700)]
ANDROID: sdcardfs: fix itnull.cocci warnings
List_for_each_entry has the property that the first argument is always
bound to a real list element, never NULL, so testing dentry is not needed.
Generated by: scripts/coccinelle/iterators/itnull.cocci
Change-Id: I51033a2649eb39451862b35b6358fe5cfe25c5f5
Cc: Daniel Rosenberg <drosen@google.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Daniel Rosenberg [Fri, 8 Jul 2016 21:15:14 +0000 (14:15 -0700)]
sdcardfs: Truncate packages_gid.list on overflow
packages_gid.list was improperly returning the wrong
count. Use scnprintf instead, and inform the user that
the list was truncated if it is.
Bug:
30013843
Change-Id: Ida2b2ef7cd86dd87300bfb4c2cdb6bfe2ee1650d
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Fri, 22 Apr 2016 07:00:14 +0000 (00:00 -0700)]
vfs: change d_canonical_path to take two paths
bug:
23904372
Change-Id: I4a686d64b6de37decf60019be1718e1d820193e6
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Mon, 28 Mar 2016 23:00:34 +0000 (16:00 -0700)]
sdcardfs: remove unneeded __init and __exit
Change-Id: I2a2d45d52f891332174c3000e8681c5167c1564f
Daniel Rosenberg [Mon, 28 Mar 2016 22:00:20 +0000 (15:00 -0700)]
sdcardfs: Remove unused code
Change-Id: Ie97cba27ce44818ac56cfe40954f164ad44eccf6
Daniel Rosenberg [Wed, 23 Mar 2016 23:39:30 +0000 (16:39 -0700)]
sdcardfs: remove effectless config option
CONFIG_SDCARD_FS_CI_SEARCH only guards a define for
LOOKUP_CASE_INSENSITIVE, which is never used in the
kernel. Remove both, along with the option matching
that supports it.
Change-Id: I363a8f31de8ee7a7a934d75300cc9ba8176e2edf
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Fri, 12 Feb 2016 00:53:36 +0000 (16:53 -0800)]
sdcardfs: Add support for d_canonicalize
Change-Id: I5d6f0e71b8ca99aec4b0894412f1dfd1cfe12add
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Daniel Rosenberg [Thu, 4 Feb 2016 05:08:21 +0000 (21:08 -0800)]
sdcardfs: Bring up to date with Android M permissions:
In M, the workings of sdcardfs were changed significantly.
This brings sdcardfs into line with the changes.
Change-Id: I10e91a84a884c838feef7aa26c0a2b21f02e052e