aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nilfs2/inode.c11
-rw-r--r--fs/nilfs2/namei.c1
-rw-r--r--fs/nilfs2/nilfs.h4
3 files changed, 13 insertions, 3 deletions
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index ca09e4362d66..3efef0ecfa24 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -764,6 +764,17 @@ out_err:
764 return err; 764 return err;
765} 765}
766 766
767int nilfs_permission(struct inode *inode, int mask)
768{
769 struct nilfs_root *root = NILFS_I(inode)->i_root;
770
771 if ((mask & MAY_WRITE) && root &&
772 root->cno != NILFS_CPTREE_CURRENT_CNO)
773 return -EROFS; /* snapshot is not writable */
774
775 return generic_permission(inode, mask, NULL);
776}
777
767int nilfs_load_inode_block(struct nilfs_sb_info *sbi, struct inode *inode, 778int nilfs_load_inode_block(struct nilfs_sb_info *sbi, struct inode *inode,
768 struct buffer_head **pbh) 779 struct buffer_head **pbh)
769{ 780{
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c
index a65f46560fbe..185d1607cb00 100644
--- a/fs/nilfs2/namei.c
+++ b/fs/nilfs2/namei.c
@@ -588,6 +588,7 @@ const struct inode_operations nilfs_symlink_inode_operations = {
588 .readlink = generic_readlink, 588 .readlink = generic_readlink,
589 .follow_link = page_follow_link_light, 589 .follow_link = page_follow_link_light,
590 .put_link = page_put_link, 590 .put_link = page_put_link,
591 .permission = nilfs_permission,
591}; 592};
592 593
593const struct export_operations nilfs_export_ops = { 594const struct export_operations nilfs_export_ops = {
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h
index 3870c109aba3..cf5507a2a178 100644
--- a/fs/nilfs2/nilfs.h
+++ b/fs/nilfs2/nilfs.h
@@ -201,12 +201,9 @@ static inline struct inode *nilfs_dat_inode(const struct the_nilfs *nilfs)
201 */ 201 */
202#ifdef CONFIG_NILFS_POSIX_ACL 202#ifdef CONFIG_NILFS_POSIX_ACL
203#error "NILFS: not yet supported POSIX ACL" 203#error "NILFS: not yet supported POSIX ACL"
204extern int nilfs_permission(struct inode *, int, struct nameidata *);
205extern int nilfs_acl_chmod(struct inode *); 204extern int nilfs_acl_chmod(struct inode *);
206extern int nilfs_init_acl(struct inode *, struct inode *); 205extern int nilfs_init_acl(struct inode *, struct inode *);
207#else 206#else
208#define nilfs_permission NULL
209
210static inline int nilfs_acl_chmod(struct inode *inode) 207static inline int nilfs_acl_chmod(struct inode *inode)
211{ 208{
212 return 0; 209 return 0;
@@ -256,6 +253,7 @@ extern void nilfs_update_inode(struct inode *, struct buffer_head *);
256extern void nilfs_truncate(struct inode *); 253extern void nilfs_truncate(struct inode *);
257extern void nilfs_evict_inode(struct inode *); 254extern void nilfs_evict_inode(struct inode *);
258extern int nilfs_setattr(struct dentry *, struct iattr *); 255extern int nilfs_setattr(struct dentry *, struct iattr *);
256int nilfs_permission(struct inode *inode, int mask);
259extern int nilfs_load_inode_block(struct nilfs_sb_info *, struct inode *, 257extern int nilfs_load_inode_block(struct nilfs_sb_info *, struct inode *,
260 struct buffer_head **); 258 struct buffer_head **);
261extern int nilfs_inode_dirty(struct inode *); 259extern int nilfs_inode_dirty(struct inode *);