return err;
 }
 
+int nilfs_permission(struct inode *inode, int mask)
+{
+       struct nilfs_root *root = NILFS_I(inode)->i_root;
+
+       if ((mask & MAY_WRITE) && root &&
+           root->cno != NILFS_CPTREE_CURRENT_CNO)
+               return -EROFS; /* snapshot is not writable */
+
+       return generic_permission(inode, mask, NULL);
+}
+
 int nilfs_load_inode_block(struct nilfs_sb_info *sbi, struct inode *inode,
                           struct buffer_head **pbh)
 {
 
        .readlink       = generic_readlink,
        .follow_link    = page_follow_link_light,
        .put_link       = page_put_link,
+       .permission     = nilfs_permission,
 };
 
 const struct export_operations nilfs_export_ops = {
 
  */
 #ifdef CONFIG_NILFS_POSIX_ACL
 #error "NILFS: not yet supported POSIX ACL"
-extern int nilfs_permission(struct inode *, int, struct nameidata *);
 extern int nilfs_acl_chmod(struct inode *);
 extern int nilfs_init_acl(struct inode *, struct inode *);
 #else
-#define nilfs_permission   NULL
-
 static inline int nilfs_acl_chmod(struct inode *inode)
 {
        return 0;
 extern void nilfs_truncate(struct inode *);
 extern void nilfs_evict_inode(struct inode *);
 extern int nilfs_setattr(struct dentry *, struct iattr *);
+int nilfs_permission(struct inode *inode, int mask);
 extern int nilfs_load_inode_block(struct nilfs_sb_info *, struct inode *,
                                  struct buffer_head **);
 extern int nilfs_inode_dirty(struct inode *);