/* * Push all data for a specific file onto permanent storage. */ static int orangefs_fsync(struct file *file, loff_t start, loff_t end, int datasync) { int ret = -EINVAL; struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(file->f_path.dentry->d_inode); struct orangefs_kernel_op_s *new_op = NULL; /* required call */ filemap_write_and_wait_range(file->f_mapping, start, end); new_op = op_alloc(ORANGEFS_VFS_OP_FSYNC); if (!new_op) return -ENOMEM; new_op->upcall.req.fsync.refn = orangefs_inode->refn; ret = service_operation(new_op, "orangefs_fsync", get_interruptible_flag(file->f_path.dentry->d_inode)); gossip_debug(GOSSIP_FILE_DEBUG, "orangefs_fsync got return value of %d\n", ret); op_release(new_op); orangefs_flush_inode(file->f_path.dentry->d_inode); return ret; }
/* * Called to notify the module that there are no more references to * this file (i.e. no processes have it open). * * \note Not called when each file is closed. */ static int orangefs_file_release(struct inode *inode, struct file *file) { gossip_debug(GOSSIP_FILE_DEBUG, "orangefs_file_release: called on %pD\n", file); orangefs_flush_inode(inode); /* * remove all associated inode pages from the page cache and * readahead cache (if any); this forces an expensive refresh of * data for the next caller of mmap (or 'get_block' accesses) */ if (file_inode(file) && file_inode(file)->i_mapping && mapping_nrpages(&file_inode(file)->i_data)) { if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) { gossip_debug(GOSSIP_INODE_DEBUG, "calling flush_racache on %pU\n", get_khandle_from_ino(inode)); flush_racache(inode); gossip_debug(GOSSIP_INODE_DEBUG, "flush_racache finished\n"); } truncate_inode_pages(file_inode(file)->i_mapping, 0); } return 0; }
/* * Push all data for a specific file onto permanent storage. */ static int orangefs_fsync(struct file *file, loff_t start, loff_t end, int datasync) { int ret; struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(file_inode(file)); struct orangefs_kernel_op_s *new_op = NULL; new_op = op_alloc(ORANGEFS_VFS_OP_FSYNC); if (!new_op) return -ENOMEM; new_op->upcall.req.fsync.refn = orangefs_inode->refn; ret = service_operation(new_op, "orangefs_fsync", get_interruptible_flag(file_inode(file))); gossip_debug(GOSSIP_FILE_DEBUG, "orangefs_fsync got return value of %d\n", ret); op_release(new_op); orangefs_flush_inode(file_inode(file)); return ret; }
int orangefs_init_acl(struct inode *inode, struct inode *dir) { struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode); struct posix_acl *default_acl, *acl; umode_t mode = inode->i_mode; int error = 0; ClearModeFlag(orangefs_inode); error = posix_acl_create(dir, &mode, &default_acl, &acl); if (error) return error; if (default_acl) { error = orangefs_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); posix_acl_release(default_acl); } if (acl) { if (!error) error = orangefs_set_acl(inode, acl, ACL_TYPE_ACCESS); posix_acl_release(acl); } /* If mode of the inode was changed, then do a forcible ->setattr */ if (mode != inode->i_mode) { SetModeFlag(orangefs_inode); inode->i_mode = mode; orangefs_flush_inode(inode); } return error; }
/* * Called to notify the module that there are no more references to * this file (i.e. no processes have it open). * * \note Not called when each file is closed. */ static int orangefs_file_release(struct inode *inode, struct file *file) { gossip_debug(GOSSIP_FILE_DEBUG, "orangefs_file_release: called on %s\n", file->f_path.dentry->d_name.name); orangefs_flush_inode(inode); /* * remove all associated inode pages from the page cache and mmap * readahead cache (if any); this forces an expensive refresh of * data for the next caller of mmap (or 'get_block' accesses) */ if (file->f_path.dentry->d_inode && file->f_path.dentry->d_inode->i_mapping && mapping_nrpages(&file->f_path.dentry->d_inode->i_data)) truncate_inode_pages(file->f_path.dentry->d_inode->i_mapping, 0); return 0; }