aboutsummaryrefslogtreecommitdiff
path: root/fs/sdcardfs/inode.c
Commit message (Collapse)AuthorAgeFilesLines
* ANDROID: sdcardfs: Use lower getattr times/sizeDaniel Rosenberg2019-07-201-10/+9
| | | | | | | | | 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
* ANDROID: sdcardfs: Change current->fs under lockDaniel Rosenberg2018-11-271-2/+13
| | | | | | | | bug: 111641492 Change-Id: I79e9894f94880048edaf0f7cfa2d180f65cbcf3b Reported-by: Jann Horn <jannh@google.com> Signed-off-by: Daniel Rosenberg <drosen@google.com>
* ANDROID: sdcardfs: Don't use OVERRIDE_CRED macroDaniel Rosenberg2018-11-271-157/+41
| | | | | | | | | | | The macro hides some control flow, making it easier to run into bugs. bug: 111642636 Change-Id: I37ec207c277d97c4e7f1e8381bc9ae743ad78435 Reported-by: Jann Horn <jannh@google.com> Signed-off-by: Daniel Rosenberg <drosen@google.com>
* ANDROID: xattr: Pass EOPNOTSUPP to permission2Daniel Rosenberg2018-01-301-0/+2
| | | | | | | | | | | | | | 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
* ANDROID: sdcardfs: Move default_normal to superblockDaniel Rosenberg2018-01-201-3/+4
| | | | | | | | | 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
* ANDROID: Sdcardfs: Move gid derivation under flagDaniel Rosenberg2017-09-131-4/+8
| | | | | | | | | 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
* ANDROID: sdcardfs: Remove unnecessary lockDaniel Rosenberg2017-07-211-6/+0
| | | | | | | | | | 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
* ANDROID: sdcardfs: Move top to its own structDaniel Rosenberg2017-05-181-24/+29
| | | | | | | | | | 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
* ANDROID: sdcardfs: Don't iput if we didn't igrabDaniel Roseberg2017-05-101-7/+2
| | | | | | | | | | | 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
* sdcardfs: indentationMister Oyster2017-04-161-0/+1
|
* ANDROID: sdcardfs: Use pr_[...] instead of printkDaniel Rosenberg2017-04-131-4/+4
| | | | | | Signed-off-by: Daniel Rosenberg <drosen@google.com> Bug: 35331000 Change-Id: Ibc635ec865750530d32b87067779f681fe58a003
* ANDROID: sdcardfs: Fix formattingDaniel Rosenberg2017-04-131-22/+30
| | | | | | | | | 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
* ANDROID: sdcardfs: Remove uninformative printsDaniel Rosenberg2017-04-131-23/+1
| | | | | | | | | 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
* ANDROID: sdcardfs: Get the blocksize from the lower fsDaniel Rosenberg2017-04-131-12/+9
| | | | | | | | | | 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
* ANDROID: sdcardfs: Use d_invalidate instead of drop_recurisveDaniel Rosenberg2017-04-131-1/+1
| | | | | | | | | | | 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
* ANDROID: sdcardfs: rate limit warning printDaniel Rosenberg2017-04-131-2/+3
| | | | | | Signed-off-by: Daniel Rosenberg <drosen@google.com> Bug: 35848445 Change-Id: Ida72ea0ece191b2ae4a8babae096b2451eb563f6
* ANDROID: sdcardfs: Switch strcasecmp for internal callDaniel Rosenberg2017-04-131-11/+13
| | | | | | | | | 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>
* ANDROID: sdcardfs: Add GID Derivation to sdcardfsDaniel Rosenberg2017-04-131-15/+20
| | | | | | | | | | | | | | | 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>
* ANDROID: sdcardfs: Remove redundant operationDaniel Rosenberg2017-04-131-11/+0
| | | | | | | | 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>
* ANDROID: sdcardfs: Allow non-owners to touchDaniel Rosenberg2017-04-131-2/+5
| | | | | | | | | | | | | | 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>
* sdcardfs: Use per mount permissionsDaniel Rosenberg2017-04-131-24/+103
| | | | | | | | | | | | | | | | | | 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>
* sdcardfs: User new permission2 functionsDaniel Rosenberg2017-04-131-6/+20
| | | | | Change-Id: Ic7e0fb8fdcebb31e657b079fe02ac834c4a50db9 Signed-off-by: Daniel Rosenberg <drosen@google.com>
* sdcardfs: Move directory unlock before touchDaniel Rosenberg2017-04-131-3/+9
| | | | | | | | | 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>
* sdcardfs: Added top to sdcardfs_inode_infoDaniel Rosenberg2017-04-131-38/+69
| | | | | | | | | | | | | | | | | | | 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>
* sdcardfs: Fix locking for permission fix upDaniel Rosenberg2017-04-111-2/+0
| | | | | | | | Iterating over d_subdirs requires taking d_lock. Removed several unneeded locks. Change-Id: I5b1588e54c7e6ee19b756d6705171c7f829e2650 Signed-off-by: Daniel Rosenberg <drosen@google.com>
* sdcardfs: override umask on mkdir and createDaniel Rosenberg2017-04-111-35/+35
| | | | | | | | | | | | 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>
* sdcardfs: Bring up to date with Android M permissions:Daniel Rosenberg2017-04-111-48/+30
| | | | | | | In M, the workings of sdcardfs were changed significantly. This brings sdcardfs into line with the changes. Change-Id: I10e91a84a884c838feef7aa26c0a2b21f02e052e
* sdcardfs: port to 3.10Daniel Campello2017-04-111-71/+16
| | | | Change-Id: I832a14cee3fcbf47ee6e5da2943a90f9dea5b60a
* Initial port of sdcardfsDaniel Campello2017-04-111-0/+886
Change-Id: I5b5772a2bbff9f3a7dda641644630a7b8afacec0