aboutsummaryrefslogtreecommitdiffstats
path: root/fs/adfs
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /fs/adfs
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'fs/adfs')
-rw-r--r--fs/adfs/adfs.h4
-rw-r--r--fs/adfs/dir.c2
-rw-r--r--fs/adfs/inode.c21
-rw-r--r--fs/adfs/super.c34
4 files changed, 24 insertions, 37 deletions
diff --git a/fs/adfs/adfs.h b/fs/adfs/adfs.h
index 585adafb0cc..718ac1f440c 100644
--- a/fs/adfs/adfs.h
+++ b/fs/adfs/adfs.h
@@ -46,8 +46,8 @@ struct adfs_sb_info {
46 struct adfs_discmap *s_map; /* bh list containing map */ 46 struct adfs_discmap *s_map; /* bh list containing map */
47 struct adfs_dir_ops *s_dir; /* directory operations */ 47 struct adfs_dir_ops *s_dir; /* directory operations */
48 48
49 kuid_t s_uid; /* owner uid */ 49 uid_t s_uid; /* owner uid */
50 kgid_t s_gid; /* owner gid */ 50 gid_t s_gid; /* owner gid */
51 umode_t s_owner_mask; /* ADFS owner perm -> unix perm */ 51 umode_t s_owner_mask; /* ADFS owner perm -> unix perm */
52 umode_t s_other_mask; /* ADFS other perm -> unix perm */ 52 umode_t s_other_mask; /* ADFS other perm -> unix perm */
53 int s_ftsuffix; /* ,xyz hex filetype suffix option */ 53 int s_ftsuffix; /* ,xyz hex filetype suffix option */
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c
index b3be2e7c564..3d83075aaa2 100644
--- a/fs/adfs/dir.c
+++ b/fs/adfs/dir.c
@@ -266,7 +266,7 @@ const struct dentry_operations adfs_dentry_operations = {
266}; 266};
267 267
268static struct dentry * 268static struct dentry *
269adfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) 269adfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
270{ 270{
271 struct inode *inode = NULL; 271 struct inode *inode = NULL;
272 struct object_info obj; 272 struct object_info obj;
diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c
index 5f95d1ed9c6..d5250c5aae2 100644
--- a/fs/adfs/inode.c
+++ b/fs/adfs/inode.c
@@ -45,14 +45,6 @@ static int adfs_readpage(struct file *file, struct page *page)
45 return block_read_full_page(page, adfs_get_block); 45 return block_read_full_page(page, adfs_get_block);
46} 46}
47 47
48static void adfs_write_failed(struct address_space *mapping, loff_t to)
49{
50 struct inode *inode = mapping->host;
51
52 if (to > inode->i_size)
53 truncate_pagecache(inode, to, inode->i_size);
54}
55
56static int adfs_write_begin(struct file *file, struct address_space *mapping, 48static int adfs_write_begin(struct file *file, struct address_space *mapping,
57 loff_t pos, unsigned len, unsigned flags, 49 loff_t pos, unsigned len, unsigned flags,
58 struct page **pagep, void **fsdata) 50 struct page **pagep, void **fsdata)
@@ -63,8 +55,11 @@ static int adfs_write_begin(struct file *file, struct address_space *mapping,
63 ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, 55 ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
64 adfs_get_block, 56 adfs_get_block,
65 &ADFS_I(mapping->host)->mmu_private); 57 &ADFS_I(mapping->host)->mmu_private);
66 if (unlikely(ret)) 58 if (unlikely(ret)) {
67 adfs_write_failed(mapping, pos + len); 59 loff_t isize = mapping->host->i_size;
60 if (pos + len > isize)
61 vmtruncate(mapping->host, isize);
62 }
68 63
69 return ret; 64 return ret;
70} 65}
@@ -252,7 +247,7 @@ adfs_iget(struct super_block *sb, struct object_info *obj)
252 inode->i_gid = ADFS_SB(sb)->s_gid; 247 inode->i_gid = ADFS_SB(sb)->s_gid;
253 inode->i_ino = obj->file_id; 248 inode->i_ino = obj->file_id;
254 inode->i_size = obj->size; 249 inode->i_size = obj->size;
255 set_nlink(inode, 2); 250 inode->i_nlink = 2;
256 inode->i_blocks = (inode->i_size + sb->s_blocksize - 1) >> 251 inode->i_blocks = (inode->i_size + sb->s_blocksize - 1) >>
257 sb->s_blocksize_bits; 252 sb->s_blocksize_bits;
258 253
@@ -309,8 +304,8 @@ adfs_notify_change(struct dentry *dentry, struct iattr *attr)
309 * we can't change the UID or GID of any file - 304 * we can't change the UID or GID of any file -
310 * we have a global UID/GID in the superblock 305 * we have a global UID/GID in the superblock
311 */ 306 */
312 if ((ia_valid & ATTR_UID && !uid_eq(attr->ia_uid, ADFS_SB(sb)->s_uid)) || 307 if ((ia_valid & ATTR_UID && attr->ia_uid != ADFS_SB(sb)->s_uid) ||
313 (ia_valid & ATTR_GID && !gid_eq(attr->ia_gid, ADFS_SB(sb)->s_gid))) 308 (ia_valid & ATTR_GID && attr->ia_gid != ADFS_SB(sb)->s_gid))
314 error = -EPERM; 309 error = -EPERM;
315 310
316 if (error) 311 if (error)
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index d5712293579..c8bf36a1996 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -15,7 +15,6 @@
15#include <linux/seq_file.h> 15#include <linux/seq_file.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/statfs.h> 17#include <linux/statfs.h>
18#include <linux/user_namespace.h>
19#include "adfs.h" 18#include "adfs.h"
20#include "dir_f.h" 19#include "dir_f.h"
21#include "dir_fplus.h" 20#include "dir_fplus.h"
@@ -127,14 +126,14 @@ static void adfs_put_super(struct super_block *sb)
127 sb->s_fs_info = NULL; 126 sb->s_fs_info = NULL;
128} 127}
129 128
130static int adfs_show_options(struct seq_file *seq, struct dentry *root) 129static int adfs_show_options(struct seq_file *seq, struct vfsmount *mnt)
131{ 130{
132 struct adfs_sb_info *asb = ADFS_SB(root->d_sb); 131 struct adfs_sb_info *asb = ADFS_SB(mnt->mnt_sb);
133 132
134 if (!uid_eq(asb->s_uid, GLOBAL_ROOT_UID)) 133 if (asb->s_uid != 0)
135 seq_printf(seq, ",uid=%u", from_kuid_munged(&init_user_ns, asb->s_uid)); 134 seq_printf(seq, ",uid=%u", asb->s_uid);
136 if (!gid_eq(asb->s_gid, GLOBAL_ROOT_GID)) 135 if (asb->s_gid != 0)
137 seq_printf(seq, ",gid=%u", from_kgid_munged(&init_user_ns, asb->s_gid)); 136 seq_printf(seq, ",gid=%u", asb->s_gid);
138 if (asb->s_owner_mask != ADFS_DEFAULT_OWNER_MASK) 137 if (asb->s_owner_mask != ADFS_DEFAULT_OWNER_MASK)
139 seq_printf(seq, ",ownmask=%o", asb->s_owner_mask); 138 seq_printf(seq, ",ownmask=%o", asb->s_owner_mask);
140 if (asb->s_other_mask != ADFS_DEFAULT_OTHER_MASK) 139 if (asb->s_other_mask != ADFS_DEFAULT_OTHER_MASK)
@@ -176,16 +175,12 @@ static int parse_options(struct super_block *sb, char *options)
176 case Opt_uid: 175 case Opt_uid:
177 if (match_int(args, &option)) 176 if (match_int(args, &option))
178 return -EINVAL; 177 return -EINVAL;
179 asb->s_uid = make_kuid(current_user_ns(), option); 178 asb->s_uid = option;
180 if (!uid_valid(asb->s_uid))
181 return -EINVAL;
182 break; 179 break;
183 case Opt_gid: 180 case Opt_gid:
184 if (match_int(args, &option)) 181 if (match_int(args, &option))
185 return -EINVAL; 182 return -EINVAL;
186 asb->s_gid = make_kgid(current_user_ns(), option); 183 asb->s_gid = option;
187 if (!gid_valid(asb->s_gid))
188 return -EINVAL;
189 break; 184 break;
190 case Opt_ownmask: 185 case Opt_ownmask:
191 if (match_octal(args, &option)) 186 if (match_octal(args, &option))
@@ -251,6 +246,7 @@ static struct inode *adfs_alloc_inode(struct super_block *sb)
251static void adfs_i_callback(struct rcu_head *head) 246static void adfs_i_callback(struct rcu_head *head)
252{ 247{
253 struct inode *inode = container_of(head, struct inode, i_rcu); 248 struct inode *inode = container_of(head, struct inode, i_rcu);
249 INIT_LIST_HEAD(&inode->i_dentry);
254 kmem_cache_free(adfs_inode_cachep, ADFS_I(inode)); 250 kmem_cache_free(adfs_inode_cachep, ADFS_I(inode));
255} 251}
256 252
@@ -280,11 +276,6 @@ static int init_inodecache(void)
280 276
281static void destroy_inodecache(void) 277static void destroy_inodecache(void)
282{ 278{
283 /*
284 * Make sure all delayed rcu free inodes are flushed before we
285 * destroy cache.
286 */
287 rcu_barrier();
288 kmem_cache_destroy(adfs_inode_cachep); 279 kmem_cache_destroy(adfs_inode_cachep);
289} 280}
290 281
@@ -379,8 +370,8 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
379 sb->s_fs_info = asb; 370 sb->s_fs_info = asb;
380 371
381 /* set default options */ 372 /* set default options */
382 asb->s_uid = GLOBAL_ROOT_UID; 373 asb->s_uid = 0;
383 asb->s_gid = GLOBAL_ROOT_GID; 374 asb->s_gid = 0;
384 asb->s_owner_mask = ADFS_DEFAULT_OWNER_MASK; 375 asb->s_owner_mask = ADFS_DEFAULT_OWNER_MASK;
385 asb->s_other_mask = ADFS_DEFAULT_OTHER_MASK; 376 asb->s_other_mask = ADFS_DEFAULT_OTHER_MASK;
386 asb->s_ftsuffix = 0; 377 asb->s_ftsuffix = 0;
@@ -492,9 +483,10 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
492 483
493 sb->s_d_op = &adfs_dentry_operations; 484 sb->s_d_op = &adfs_dentry_operations;
494 root = adfs_iget(sb, &root_obj); 485 root = adfs_iget(sb, &root_obj);
495 sb->s_root = d_make_root(root); 486 sb->s_root = d_alloc_root(root);
496 if (!sb->s_root) { 487 if (!sb->s_root) {
497 int i; 488 int i;
489 iput(root);
498 for (i = 0; i < asb->s_map_size; i++) 490 for (i = 0; i < asb->s_map_size; i++)
499 brelse(asb->s_map[i].dm_bh); 491 brelse(asb->s_map[i].dm_bh);
500 kfree(asb->s_map); 492 kfree(asb->s_map);