David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
Steven Whitehouse | 3a8a9a1 | 2006-05-18 15:09:15 -0400 | [diff] [blame] | 3 | * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 4 | * |
| 5 | * This copyrighted material is made available to anyone wishing to use, |
| 6 | * modify, copy, or redistribute it subject to the terms and conditions |
Steven Whitehouse | e9fc2aa | 2006-09-01 11:05:15 -0400 | [diff] [blame] | 7 | * of the GNU General Public License version 2. |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #include <linux/sched.h> |
| 11 | #include <linux/slab.h> |
| 12 | #include <linux/spinlock.h> |
| 13 | #include <linux/completion.h> |
| 14 | #include <linux/buffer_head.h> |
| 15 | #include <linux/pagemap.h> |
| 16 | #include <linux/uio.h> |
| 17 | #include <linux/blkdev.h> |
| 18 | #include <linux/mm.h> |
| 19 | #include <linux/smp_lock.h> |
Steven Whitehouse | 18ec7d5 | 2006-02-08 11:50:51 +0000 | [diff] [blame] | 20 | #include <linux/fs.h> |
Steven Whitehouse | 5c676f6 | 2006-02-27 17:23:27 -0500 | [diff] [blame] | 21 | #include <linux/gfs2_ondisk.h> |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 22 | #include <linux/ext2_fs.h> |
| 23 | #include <linux/crc32.h> |
Steven Whitehouse | 7ea9ea8 | 2006-03-31 15:01:28 -0500 | [diff] [blame] | 24 | #include <linux/iflags.h> |
Fabio Massimo Di Nitto | 7d30859 | 2006-09-19 07:56:29 +0200 | [diff] [blame] | 25 | #include <linux/lm_interface.h> |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 26 | #include <asm/uaccess.h> |
| 27 | |
| 28 | #include "gfs2.h" |
Steven Whitehouse | 5c676f6 | 2006-02-27 17:23:27 -0500 | [diff] [blame] | 29 | #include "incore.h" |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 30 | #include "bmap.h" |
| 31 | #include "dir.h" |
| 32 | #include "glock.h" |
| 33 | #include "glops.h" |
| 34 | #include "inode.h" |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 35 | #include "lm.h" |
| 36 | #include "log.h" |
| 37 | #include "meta_io.h" |
| 38 | #include "ops_file.h" |
| 39 | #include "ops_vm.h" |
| 40 | #include "quota.h" |
| 41 | #include "rgrp.h" |
| 42 | #include "trans.h" |
Steven Whitehouse | 5c676f6 | 2006-02-27 17:23:27 -0500 | [diff] [blame] | 43 | #include "util.h" |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 44 | #include "eaops.h" |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 45 | |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 46 | /* For regular, non-NFS */ |
| 47 | struct filldir_reg { |
| 48 | struct gfs2_sbd *fdr_sbd; |
| 49 | int fdr_prefetch; |
| 50 | |
| 51 | filldir_t fdr_filldir; |
| 52 | void *fdr_opaque; |
| 53 | }; |
| 54 | |
Steven Whitehouse | 61a30dc | 2006-02-15 10:15:18 +0000 | [diff] [blame] | 55 | /* |
| 56 | * Most fields left uninitialised to catch anybody who tries to |
| 57 | * use them. f_flags set to prevent file_accessed() from touching |
| 58 | * any other part of this. Its use is purely as a flag so that we |
| 59 | * know (in readpage()) whether or not do to locking. |
| 60 | */ |
Steven Whitehouse | dd538c8 | 2006-09-04 14:53:30 -0400 | [diff] [blame] | 61 | struct file gfs2_internal_file_sentinel = { |
Steven Whitehouse | 61a30dc | 2006-02-15 10:15:18 +0000 | [diff] [blame] | 62 | .f_flags = O_NOATIME|O_RDONLY, |
| 63 | }; |
| 64 | |
Steven Whitehouse | 18ec7d5 | 2006-02-08 11:50:51 +0000 | [diff] [blame] | 65 | static int gfs2_read_actor(read_descriptor_t *desc, struct page *page, |
| 66 | unsigned long offset, unsigned long size) |
| 67 | { |
| 68 | char *kaddr; |
| 69 | unsigned long count = desc->count; |
| 70 | |
| 71 | if (size > count) |
| 72 | size = count; |
| 73 | |
| 74 | kaddr = kmap(page); |
| 75 | memcpy(desc->arg.buf, kaddr + offset, size); |
Steven Whitehouse | 26c1a57 | 2006-09-04 15:32:10 -0400 | [diff] [blame] | 76 | kunmap(page); |
Steven Whitehouse | 18ec7d5 | 2006-02-08 11:50:51 +0000 | [diff] [blame] | 77 | |
Steven Whitehouse | 26c1a57 | 2006-09-04 15:32:10 -0400 | [diff] [blame] | 78 | desc->count = count - size; |
| 79 | desc->written += size; |
| 80 | desc->arg.buf += size; |
| 81 | return size; |
Steven Whitehouse | 18ec7d5 | 2006-02-08 11:50:51 +0000 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | int gfs2_internal_read(struct gfs2_inode *ip, struct file_ra_state *ra_state, |
| 85 | char *buf, loff_t *pos, unsigned size) |
| 86 | { |
Steven Whitehouse | feaa7bb | 2006-06-14 15:32:57 -0400 | [diff] [blame] | 87 | struct inode *inode = &ip->i_inode; |
Steven Whitehouse | 18ec7d5 | 2006-02-08 11:50:51 +0000 | [diff] [blame] | 88 | read_descriptor_t desc; |
| 89 | desc.written = 0; |
| 90 | desc.arg.buf = buf; |
| 91 | desc.count = size; |
| 92 | desc.error = 0; |
Steven Whitehouse | 61a30dc | 2006-02-15 10:15:18 +0000 | [diff] [blame] | 93 | do_generic_mapping_read(inode->i_mapping, ra_state, |
Steven Whitehouse | dd538c8 | 2006-09-04 14:53:30 -0400 | [diff] [blame] | 94 | &gfs2_internal_file_sentinel, pos, &desc, |
Steven Whitehouse | 61a30dc | 2006-02-15 10:15:18 +0000 | [diff] [blame] | 95 | gfs2_read_actor); |
Steven Whitehouse | 18ec7d5 | 2006-02-08 11:50:51 +0000 | [diff] [blame] | 96 | return desc.written ? desc.written : desc.error; |
| 97 | } |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 98 | |
| 99 | /** |
| 100 | * gfs2_llseek - seek to a location in a file |
| 101 | * @file: the file |
| 102 | * @offset: the offset |
| 103 | * @origin: Where to seek from (SEEK_SET, SEEK_CUR, or SEEK_END) |
| 104 | * |
| 105 | * SEEK_END requires the glock for the file because it references the |
| 106 | * file's size. |
| 107 | * |
| 108 | * Returns: The new offset, or errno |
| 109 | */ |
| 110 | |
| 111 | static loff_t gfs2_llseek(struct file *file, loff_t offset, int origin) |
| 112 | { |
Steven Whitehouse | feaa7bb | 2006-06-14 15:32:57 -0400 | [diff] [blame] | 113 | struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 114 | struct gfs2_holder i_gh; |
| 115 | loff_t error; |
| 116 | |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 117 | if (origin == 2) { |
| 118 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, |
| 119 | &i_gh); |
| 120 | if (!error) { |
| 121 | error = remote_llseek(file, offset, origin); |
| 122 | gfs2_glock_dq_uninit(&i_gh); |
| 123 | } |
| 124 | } else |
| 125 | error = remote_llseek(file, offset, origin); |
| 126 | |
| 127 | return error; |
| 128 | } |
| 129 | |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 130 | /** |
Steven Whitehouse | f0e522a | 2006-09-19 16:41:11 -0400 | [diff] [blame] | 131 | * filldir_func - Report a directory entry to the caller of gfs2_dir_read() |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 132 | * @opaque: opaque data used by the function |
| 133 | * @name: the name of the directory entry |
| 134 | * @length: the length of the name |
| 135 | * @offset: the entry's offset in the directory |
| 136 | * @inum: the inode number the entry points to |
| 137 | * @type: the type of inode the entry points to |
| 138 | * |
| 139 | * Returns: 0 on success, 1 if buffer full |
| 140 | */ |
| 141 | |
Steven Whitehouse | f0e522a | 2006-09-19 16:41:11 -0400 | [diff] [blame] | 142 | static int filldir_func(void *opaque, const char *name, unsigned int length, |
| 143 | u64 offset, struct gfs2_inum *inum, |
| 144 | unsigned int type) |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 145 | { |
| 146 | struct filldir_reg *fdr = (struct filldir_reg *)opaque; |
| 147 | struct gfs2_sbd *sdp = fdr->fdr_sbd; |
| 148 | int error; |
| 149 | |
| 150 | error = fdr->fdr_filldir(fdr->fdr_opaque, name, length, offset, |
Steven Whitehouse | 4340fe6 | 2006-07-11 09:46:33 -0400 | [diff] [blame] | 151 | inum->no_addr, type); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 152 | if (error) |
| 153 | return 1; |
| 154 | |
| 155 | if (fdr->fdr_prefetch && !(length == 1 && *name == '.')) { |
Steven Whitehouse | f0e522a | 2006-09-19 16:41:11 -0400 | [diff] [blame] | 156 | gfs2_glock_prefetch_num(sdp, inum->no_addr, &gfs2_inode_glops, |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 157 | LM_ST_SHARED, LM_FLAG_TRY | LM_FLAG_ANY); |
Steven Whitehouse | f0e522a | 2006-09-19 16:41:11 -0400 | [diff] [blame] | 158 | gfs2_glock_prefetch_num(sdp, inum->no_addr, &gfs2_iopen_glops, |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 159 | LM_ST_SHARED, LM_FLAG_TRY); |
| 160 | } |
| 161 | |
| 162 | return 0; |
| 163 | } |
| 164 | |
| 165 | /** |
Steven Whitehouse | f0e522a | 2006-09-19 16:41:11 -0400 | [diff] [blame] | 166 | * gfs2_readdir - Read directory entries from a directory |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 167 | * @file: The directory to read from |
| 168 | * @dirent: Buffer for dirents |
| 169 | * @filldir: Function used to do the copying |
| 170 | * |
| 171 | * Returns: errno |
| 172 | */ |
| 173 | |
Steven Whitehouse | f0e522a | 2006-09-19 16:41:11 -0400 | [diff] [blame] | 174 | static int gfs2_readdir(struct file *file, void *dirent, filldir_t filldir) |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 175 | { |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 176 | struct inode *dir = file->f_mapping->host; |
Steven Whitehouse | feaa7bb | 2006-06-14 15:32:57 -0400 | [diff] [blame] | 177 | struct gfs2_inode *dip = GFS2_I(dir); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 178 | struct filldir_reg fdr; |
| 179 | struct gfs2_holder d_gh; |
Steven Whitehouse | cd91549 | 2006-09-04 12:49:07 -0400 | [diff] [blame] | 180 | u64 offset = file->f_pos; |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 181 | int error; |
| 182 | |
Steven Whitehouse | feaa7bb | 2006-06-14 15:32:57 -0400 | [diff] [blame] | 183 | fdr.fdr_sbd = GFS2_SB(dir); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 184 | fdr.fdr_prefetch = 1; |
| 185 | fdr.fdr_filldir = filldir; |
| 186 | fdr.fdr_opaque = dirent; |
| 187 | |
| 188 | gfs2_holder_init(dip->i_gl, LM_ST_SHARED, GL_ATIME, &d_gh); |
| 189 | error = gfs2_glock_nq_atime(&d_gh); |
| 190 | if (error) { |
| 191 | gfs2_holder_uninit(&d_gh); |
| 192 | return error; |
| 193 | } |
| 194 | |
Steven Whitehouse | f0e522a | 2006-09-19 16:41:11 -0400 | [diff] [blame] | 195 | error = gfs2_dir_read(dir, &offset, &fdr, filldir_func); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 196 | |
| 197 | gfs2_glock_dq_uninit(&d_gh); |
| 198 | |
| 199 | file->f_pos = offset; |
| 200 | |
| 201 | return error; |
| 202 | } |
| 203 | |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 204 | |
Steven Whitehouse | 7ea9ea8 | 2006-03-31 15:01:28 -0500 | [diff] [blame] | 205 | static const u32 iflags_to_gfs2[32] = { |
| 206 | [iflag_Sync] = GFS2_DIF_SYNC, |
| 207 | [iflag_Immutable] = GFS2_DIF_IMMUTABLE, |
| 208 | [iflag_Append] = GFS2_DIF_APPENDONLY, |
| 209 | [iflag_NoAtime] = GFS2_DIF_NOATIME, |
| 210 | [iflag_Index] = GFS2_DIF_EXHASH, |
| 211 | [iflag_JournalData] = GFS2_DIF_JDATA, |
| 212 | [iflag_DirectIO] = GFS2_DIF_DIRECTIO, |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 213 | }; |
| 214 | |
Steven Whitehouse | 7ea9ea8 | 2006-03-31 15:01:28 -0500 | [diff] [blame] | 215 | static const u32 gfs2_to_iflags[32] = { |
| 216 | [gfs2fl_Sync] = IFLAG_SYNC, |
| 217 | [gfs2fl_Immutable] = IFLAG_IMMUTABLE, |
| 218 | [gfs2fl_AppendOnly] = IFLAG_APPEND, |
| 219 | [gfs2fl_NoAtime] = IFLAG_NOATIME, |
| 220 | [gfs2fl_ExHash] = IFLAG_INDEX, |
| 221 | [gfs2fl_Jdata] = IFLAG_JOURNAL_DATA, |
| 222 | [gfs2fl_Directio] = IFLAG_DIRECTIO, |
Steven Whitehouse | 4bcf709 | 2006-04-25 13:20:27 -0400 | [diff] [blame] | 223 | [gfs2fl_InheritDirectio] = IFLAG_DIRECTIO, |
| 224 | [gfs2fl_InheritJdata] = IFLAG_JOURNAL_DATA, |
Steven Whitehouse | 7ea9ea8 | 2006-03-31 15:01:28 -0500 | [diff] [blame] | 225 | }; |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 226 | |
Steven Whitehouse | b09e593 | 2006-04-07 11:17:32 -0400 | [diff] [blame] | 227 | static int gfs2_get_flags(struct file *filp, u32 __user *ptr) |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 228 | { |
Steven Whitehouse | b09e593 | 2006-04-07 11:17:32 -0400 | [diff] [blame] | 229 | struct inode *inode = filp->f_dentry->d_inode; |
Steven Whitehouse | feaa7bb | 2006-06-14 15:32:57 -0400 | [diff] [blame] | 230 | struct gfs2_inode *ip = GFS2_I(inode); |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 231 | struct gfs2_holder gh; |
| 232 | int error; |
Steven Whitehouse | 7ea9ea8 | 2006-03-31 15:01:28 -0500 | [diff] [blame] | 233 | u32 iflags; |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 234 | |
| 235 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh); |
| 236 | error = gfs2_glock_nq_m_atime(1, &gh); |
| 237 | if (error) |
| 238 | return error; |
Steven Whitehouse | 907b9bc | 2006-09-25 09:26:04 -0400 | [diff] [blame] | 239 | |
Steven Whitehouse | 7ea9ea8 | 2006-03-31 15:01:28 -0500 | [diff] [blame] | 240 | iflags = iflags_cvt(gfs2_to_iflags, ip->i_di.di_flags); |
| 241 | if (put_user(iflags, ptr)) |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 242 | error = -EFAULT; |
| 243 | |
| 244 | gfs2_glock_dq_m(1, &gh); |
| 245 | gfs2_holder_uninit(&gh); |
| 246 | return error; |
| 247 | } |
| 248 | |
| 249 | /* Flags that can be set by user space */ |
| 250 | #define GFS2_FLAGS_USER_SET (GFS2_DIF_JDATA| \ |
| 251 | GFS2_DIF_DIRECTIO| \ |
| 252 | GFS2_DIF_IMMUTABLE| \ |
| 253 | GFS2_DIF_APPENDONLY| \ |
| 254 | GFS2_DIF_NOATIME| \ |
| 255 | GFS2_DIF_SYNC| \ |
| 256 | GFS2_DIF_SYSTEM| \ |
| 257 | GFS2_DIF_INHERIT_DIRECTIO| \ |
| 258 | GFS2_DIF_INHERIT_JDATA) |
| 259 | |
| 260 | /** |
| 261 | * gfs2_set_flags - set flags on an inode |
| 262 | * @inode: The inode |
| 263 | * @flags: The flags to set |
| 264 | * @mask: Indicates which flags are valid |
| 265 | * |
| 266 | */ |
Steven Whitehouse | b09e593 | 2006-04-07 11:17:32 -0400 | [diff] [blame] | 267 | static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 268 | { |
Steven Whitehouse | b09e593 | 2006-04-07 11:17:32 -0400 | [diff] [blame] | 269 | struct inode *inode = filp->f_dentry->d_inode; |
Steven Whitehouse | feaa7bb | 2006-06-14 15:32:57 -0400 | [diff] [blame] | 270 | struct gfs2_inode *ip = GFS2_I(inode); |
| 271 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 272 | struct buffer_head *bh; |
| 273 | struct gfs2_holder gh; |
| 274 | int error; |
Steven Whitehouse | 55eccc6 | 2006-04-04 14:29:30 -0400 | [diff] [blame] | 275 | u32 new_flags, flags; |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 276 | |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 277 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); |
Abhijith Das | 52f341c | 2006-07-21 02:03:21 -0400 | [diff] [blame] | 278 | if (error) |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 279 | return error; |
| 280 | |
Steven Whitehouse | 55eccc6 | 2006-04-04 14:29:30 -0400 | [diff] [blame] | 281 | flags = ip->i_di.di_flags; |
| 282 | new_flags = (flags & ~mask) | (reqflags & mask); |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 283 | if ((new_flags ^ flags) == 0) |
| 284 | goto out; |
| 285 | |
Steven Whitehouse | 4bcf709 | 2006-04-25 13:20:27 -0400 | [diff] [blame] | 286 | if (S_ISDIR(inode->i_mode)) { |
| 287 | if ((new_flags ^ flags) & GFS2_DIF_JDATA) |
| 288 | new_flags ^= (GFS2_DIF_JDATA|GFS2_DIF_INHERIT_JDATA); |
| 289 | if ((new_flags ^ flags) & GFS2_DIF_DIRECTIO) |
| 290 | new_flags ^= (GFS2_DIF_DIRECTIO|GFS2_DIF_INHERIT_DIRECTIO); |
| 291 | } |
| 292 | |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 293 | error = -EINVAL; |
| 294 | if ((new_flags ^ flags) & ~GFS2_FLAGS_USER_SET) |
| 295 | goto out; |
| 296 | |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 297 | error = -EPERM; |
| 298 | if (IS_IMMUTABLE(inode) && (new_flags & GFS2_DIF_IMMUTABLE)) |
| 299 | goto out; |
| 300 | if (IS_APPEND(inode) && (new_flags & GFS2_DIF_APPENDONLY)) |
| 301 | goto out; |
Steven Whitehouse | 907b9bc | 2006-09-25 09:26:04 -0400 | [diff] [blame] | 302 | if (((new_flags ^ flags) & GFS2_DIF_IMMUTABLE) && |
Steven Whitehouse | b9cb981 | 2006-05-12 17:07:56 -0400 | [diff] [blame] | 303 | !capable(CAP_LINUX_IMMUTABLE)) |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 304 | goto out; |
Steven Whitehouse | b9cb981 | 2006-05-12 17:07:56 -0400 | [diff] [blame] | 305 | if (!IS_IMMUTABLE(inode)) { |
Steven Whitehouse | faf450e | 2006-06-22 10:59:10 -0400 | [diff] [blame] | 306 | error = permission(inode, MAY_WRITE, NULL); |
Steven Whitehouse | b9cb981 | 2006-05-12 17:07:56 -0400 | [diff] [blame] | 307 | if (error) |
| 308 | goto out; |
| 309 | } |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 310 | |
Steven Whitehouse | 55eccc6 | 2006-04-04 14:29:30 -0400 | [diff] [blame] | 311 | error = gfs2_trans_begin(sdp, RES_DINODE, 0); |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 312 | if (error) |
| 313 | goto out; |
Steven Whitehouse | 55eccc6 | 2006-04-04 14:29:30 -0400 | [diff] [blame] | 314 | error = gfs2_meta_inode_buffer(ip, &bh); |
| 315 | if (error) |
| 316 | goto out_trans_end; |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 317 | gfs2_trans_add_bh(ip->i_gl, bh, 1); |
| 318 | ip->i_di.di_flags = new_flags; |
| 319 | gfs2_dinode_out(&ip->i_di, bh->b_data); |
| 320 | brelse(bh); |
Steven Whitehouse | 55eccc6 | 2006-04-04 14:29:30 -0400 | [diff] [blame] | 321 | out_trans_end: |
| 322 | gfs2_trans_end(sdp); |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 323 | out: |
| 324 | gfs2_glock_dq_uninit(&gh); |
| 325 | return error; |
| 326 | } |
| 327 | |
Steven Whitehouse | b09e593 | 2006-04-07 11:17:32 -0400 | [diff] [blame] | 328 | static int gfs2_set_flags(struct file *filp, u32 __user *ptr) |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 329 | { |
Steven Whitehouse | 7ea9ea8 | 2006-03-31 15:01:28 -0500 | [diff] [blame] | 330 | u32 iflags, gfsflags; |
| 331 | if (get_user(iflags, ptr)) |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 332 | return -EFAULT; |
Steven Whitehouse | 7ea9ea8 | 2006-03-31 15:01:28 -0500 | [diff] [blame] | 333 | gfsflags = iflags_cvt(iflags_to_gfs2, iflags); |
Steven Whitehouse | b09e593 | 2006-04-07 11:17:32 -0400 | [diff] [blame] | 334 | return do_gfs2_set_flags(filp, gfsflags, ~0); |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 335 | } |
| 336 | |
Steven Whitehouse | b09e593 | 2006-04-07 11:17:32 -0400 | [diff] [blame] | 337 | static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 338 | { |
| 339 | switch(cmd) { |
Steven Whitehouse | 7ea9ea8 | 2006-03-31 15:01:28 -0500 | [diff] [blame] | 340 | case IFLAGS_GET_IOC: |
Steven Whitehouse | b09e593 | 2006-04-07 11:17:32 -0400 | [diff] [blame] | 341 | return gfs2_get_flags(filp, (u32 __user *)arg); |
Steven Whitehouse | 7ea9ea8 | 2006-03-31 15:01:28 -0500 | [diff] [blame] | 342 | case IFLAGS_SET_IOC: |
Steven Whitehouse | b09e593 | 2006-04-07 11:17:32 -0400 | [diff] [blame] | 343 | return gfs2_set_flags(filp, (u32 __user *)arg); |
Steven Whitehouse | 71b86f5 | 2006-03-28 14:14:04 -0500 | [diff] [blame] | 344 | } |
| 345 | return -ENOTTY; |
| 346 | } |
| 347 | |
| 348 | |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 349 | /** |
| 350 | * gfs2_mmap - |
| 351 | * @file: The file to map |
| 352 | * @vma: The VMA which described the mapping |
| 353 | * |
| 354 | * Returns: 0 or error code |
| 355 | */ |
| 356 | |
| 357 | static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) |
| 358 | { |
Steven Whitehouse | feaa7bb | 2006-06-14 15:32:57 -0400 | [diff] [blame] | 359 | struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 360 | struct gfs2_holder i_gh; |
| 361 | int error; |
| 362 | |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 363 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &i_gh); |
| 364 | error = gfs2_glock_nq_atime(&i_gh); |
| 365 | if (error) { |
| 366 | gfs2_holder_uninit(&i_gh); |
| 367 | return error; |
| 368 | } |
| 369 | |
Steven Whitehouse | 18ec7d5 | 2006-02-08 11:50:51 +0000 | [diff] [blame] | 370 | /* This is VM_MAYWRITE instead of VM_WRITE because a call |
| 371 | to mprotect() can turn on VM_WRITE later. */ |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 372 | |
Steven Whitehouse | 18ec7d5 | 2006-02-08 11:50:51 +0000 | [diff] [blame] | 373 | if ((vma->vm_flags & (VM_MAYSHARE | VM_MAYWRITE)) == |
| 374 | (VM_MAYSHARE | VM_MAYWRITE)) |
| 375 | vma->vm_ops = &gfs2_vm_ops_sharewrite; |
| 376 | else |
| 377 | vma->vm_ops = &gfs2_vm_ops_private; |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 378 | |
| 379 | gfs2_glock_dq_uninit(&i_gh); |
| 380 | |
| 381 | return error; |
| 382 | } |
| 383 | |
| 384 | /** |
| 385 | * gfs2_open - open a file |
| 386 | * @inode: the inode to open |
| 387 | * @file: the struct file for this opening |
| 388 | * |
| 389 | * Returns: errno |
| 390 | */ |
| 391 | |
| 392 | static int gfs2_open(struct inode *inode, struct file *file) |
| 393 | { |
Steven Whitehouse | feaa7bb | 2006-06-14 15:32:57 -0400 | [diff] [blame] | 394 | struct gfs2_inode *ip = GFS2_I(inode); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 395 | struct gfs2_holder i_gh; |
| 396 | struct gfs2_file *fp; |
| 397 | int error; |
| 398 | |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 399 | fp = kzalloc(sizeof(struct gfs2_file), GFP_KERNEL); |
| 400 | if (!fp) |
| 401 | return -ENOMEM; |
| 402 | |
Steven Whitehouse | f55ab26 | 2006-02-21 12:51:39 +0000 | [diff] [blame] | 403 | mutex_init(&fp->f_fl_mutex); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 404 | |
Steven Whitehouse | feaa7bb | 2006-06-14 15:32:57 -0400 | [diff] [blame] | 405 | gfs2_assert_warn(GFS2_SB(inode), !file->private_data); |
Steven Whitehouse | 5c676f6 | 2006-02-27 17:23:27 -0500 | [diff] [blame] | 406 | file->private_data = fp; |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 407 | |
| 408 | if (S_ISREG(ip->i_di.di_mode)) { |
| 409 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, |
| 410 | &i_gh); |
| 411 | if (error) |
| 412 | goto fail; |
| 413 | |
| 414 | if (!(file->f_flags & O_LARGEFILE) && |
| 415 | ip->i_di.di_size > MAX_NON_LFS) { |
| 416 | error = -EFBIG; |
| 417 | goto fail_gunlock; |
| 418 | } |
| 419 | |
| 420 | /* Listen to the Direct I/O flag */ |
| 421 | |
| 422 | if (ip->i_di.di_flags & GFS2_DIF_DIRECTIO) |
| 423 | file->f_flags |= O_DIRECT; |
| 424 | |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 425 | gfs2_glock_dq_uninit(&i_gh); |
| 426 | } |
| 427 | |
| 428 | return 0; |
| 429 | |
Steven Whitehouse | 420b9e5 | 2006-07-31 15:42:17 -0400 | [diff] [blame] | 430 | fail_gunlock: |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 431 | gfs2_glock_dq_uninit(&i_gh); |
Steven Whitehouse | 420b9e5 | 2006-07-31 15:42:17 -0400 | [diff] [blame] | 432 | fail: |
Steven Whitehouse | 5c676f6 | 2006-02-27 17:23:27 -0500 | [diff] [blame] | 433 | file->private_data = NULL; |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 434 | kfree(fp); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 435 | return error; |
| 436 | } |
| 437 | |
| 438 | /** |
| 439 | * gfs2_close - called to close a struct file |
| 440 | * @inode: the inode the struct file belongs to |
| 441 | * @file: the struct file being closed |
| 442 | * |
| 443 | * Returns: errno |
| 444 | */ |
| 445 | |
| 446 | static int gfs2_close(struct inode *inode, struct file *file) |
| 447 | { |
Steven Whitehouse | 5c676f6 | 2006-02-27 17:23:27 -0500 | [diff] [blame] | 448 | struct gfs2_sbd *sdp = inode->i_sb->s_fs_info; |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 449 | struct gfs2_file *fp; |
| 450 | |
Steven Whitehouse | 5c676f6 | 2006-02-27 17:23:27 -0500 | [diff] [blame] | 451 | fp = file->private_data; |
| 452 | file->private_data = NULL; |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 453 | |
| 454 | if (gfs2_assert_warn(sdp, fp)) |
| 455 | return -EIO; |
| 456 | |
| 457 | kfree(fp); |
| 458 | |
| 459 | return 0; |
| 460 | } |
| 461 | |
| 462 | /** |
| 463 | * gfs2_fsync - sync the dirty data for a file (across the cluster) |
| 464 | * @file: the file that points to the dentry (we ignore this) |
| 465 | * @dentry: the dentry that points to the inode to sync |
| 466 | * |
| 467 | * Returns: errno |
| 468 | */ |
| 469 | |
| 470 | static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync) |
| 471 | { |
Steven Whitehouse | feaa7bb | 2006-06-14 15:32:57 -0400 | [diff] [blame] | 472 | struct gfs2_inode *ip = GFS2_I(dentry->d_inode); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 473 | |
Steven Whitehouse | b09e593 | 2006-04-07 11:17:32 -0400 | [diff] [blame] | 474 | gfs2_log_flush(ip->i_gl->gl_sbd, ip->i_gl); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 475 | |
| 476 | return 0; |
| 477 | } |
| 478 | |
| 479 | /** |
| 480 | * gfs2_lock - acquire/release a posix lock on a file |
| 481 | * @file: the file pointer |
| 482 | * @cmd: either modify or retrieve lock state, possibly wait |
| 483 | * @fl: type and range of lock |
| 484 | * |
| 485 | * Returns: errno |
| 486 | */ |
| 487 | |
| 488 | static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl) |
| 489 | { |
Steven Whitehouse | feaa7bb | 2006-06-14 15:32:57 -0400 | [diff] [blame] | 490 | struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); |
| 491 | struct gfs2_sbd *sdp = GFS2_SB(file->f_mapping->host); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 492 | struct lm_lockname name = |
| 493 | { .ln_number = ip->i_num.no_addr, |
| 494 | .ln_type = LM_TYPE_PLOCK }; |
| 495 | |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 496 | if (!(fl->fl_flags & FL_POSIX)) |
| 497 | return -ENOLCK; |
| 498 | if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID) |
| 499 | return -ENOLCK; |
| 500 | |
| 501 | if (sdp->sd_args.ar_localflocks) { |
| 502 | if (IS_GETLK(cmd)) { |
Steven Whitehouse | 8628de0 | 2006-03-31 16:48:41 -0500 | [diff] [blame] | 503 | struct file_lock tmp; |
| 504 | int ret; |
| 505 | ret = posix_test_lock(file, fl, &tmp); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 506 | fl->fl_type = F_UNLCK; |
Steven Whitehouse | 8628de0 | 2006-03-31 16:48:41 -0500 | [diff] [blame] | 507 | if (ret) |
| 508 | memcpy(fl, &tmp, sizeof(struct file_lock)); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 509 | return 0; |
| 510 | } else { |
Steven Whitehouse | 8628de0 | 2006-03-31 16:48:41 -0500 | [diff] [blame] | 511 | return posix_lock_file_wait(file, fl); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 512 | } |
| 513 | } |
| 514 | |
| 515 | if (IS_GETLK(cmd)) |
| 516 | return gfs2_lm_plock_get(sdp, &name, file, fl); |
| 517 | else if (fl->fl_type == F_UNLCK) |
| 518 | return gfs2_lm_punlock(sdp, &name, file, fl); |
| 519 | else |
| 520 | return gfs2_lm_plock(sdp, &name, file, cmd, fl); |
| 521 | } |
| 522 | |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 523 | static int do_flock(struct file *file, int cmd, struct file_lock *fl) |
| 524 | { |
Steven Whitehouse | 5c676f6 | 2006-02-27 17:23:27 -0500 | [diff] [blame] | 525 | struct gfs2_file *fp = file->private_data; |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 526 | struct gfs2_holder *fl_gh = &fp->f_fl_gh; |
Steven Whitehouse | feaa7bb | 2006-06-14 15:32:57 -0400 | [diff] [blame] | 527 | struct gfs2_inode *ip = GFS2_I(file->f_dentry->d_inode); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 528 | struct gfs2_glock *gl; |
| 529 | unsigned int state; |
| 530 | int flags; |
| 531 | int error = 0; |
| 532 | |
| 533 | state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED; |
Steven Whitehouse | 26c1a57 | 2006-09-04 15:32:10 -0400 | [diff] [blame] | 534 | flags = (IS_SETLKW(cmd) ? 0 : LM_FLAG_TRY) | GL_EXACT | GL_NOCACHE; |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 535 | |
Steven Whitehouse | f55ab26 | 2006-02-21 12:51:39 +0000 | [diff] [blame] | 536 | mutex_lock(&fp->f_fl_mutex); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 537 | |
| 538 | gl = fl_gh->gh_gl; |
| 539 | if (gl) { |
| 540 | if (fl_gh->gh_state == state) |
| 541 | goto out; |
| 542 | gfs2_glock_hold(gl); |
| 543 | flock_lock_file_wait(file, |
Steven Whitehouse | 907b9bc | 2006-09-25 09:26:04 -0400 | [diff] [blame] | 544 | &(struct file_lock){.fl_type = F_UNLCK}); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 545 | gfs2_glock_dq_uninit(fl_gh); |
| 546 | } else { |
Steven Whitehouse | feaa7bb | 2006-06-14 15:32:57 -0400 | [diff] [blame] | 547 | error = gfs2_glock_get(GFS2_SB(&ip->i_inode), |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 548 | ip->i_num.no_addr, &gfs2_flock_glops, |
| 549 | CREATE, &gl); |
| 550 | if (error) |
| 551 | goto out; |
| 552 | } |
| 553 | |
| 554 | gfs2_holder_init(gl, state, flags, fl_gh); |
| 555 | gfs2_glock_put(gl); |
| 556 | |
| 557 | error = gfs2_glock_nq(fl_gh); |
| 558 | if (error) { |
| 559 | gfs2_holder_uninit(fl_gh); |
| 560 | if (error == GLR_TRYFAILED) |
| 561 | error = -EAGAIN; |
| 562 | } else { |
| 563 | error = flock_lock_file_wait(file, fl); |
Steven Whitehouse | feaa7bb | 2006-06-14 15:32:57 -0400 | [diff] [blame] | 564 | gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 565 | } |
| 566 | |
Steven Whitehouse | 420b9e5 | 2006-07-31 15:42:17 -0400 | [diff] [blame] | 567 | out: |
Steven Whitehouse | f55ab26 | 2006-02-21 12:51:39 +0000 | [diff] [blame] | 568 | mutex_unlock(&fp->f_fl_mutex); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 569 | return error; |
| 570 | } |
| 571 | |
| 572 | static void do_unflock(struct file *file, struct file_lock *fl) |
| 573 | { |
Steven Whitehouse | 5c676f6 | 2006-02-27 17:23:27 -0500 | [diff] [blame] | 574 | struct gfs2_file *fp = file->private_data; |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 575 | struct gfs2_holder *fl_gh = &fp->f_fl_gh; |
| 576 | |
Steven Whitehouse | f55ab26 | 2006-02-21 12:51:39 +0000 | [diff] [blame] | 577 | mutex_lock(&fp->f_fl_mutex); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 578 | flock_lock_file_wait(file, fl); |
| 579 | if (fl_gh->gh_gl) |
| 580 | gfs2_glock_dq_uninit(fl_gh); |
Steven Whitehouse | f55ab26 | 2006-02-21 12:51:39 +0000 | [diff] [blame] | 581 | mutex_unlock(&fp->f_fl_mutex); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 582 | } |
| 583 | |
| 584 | /** |
| 585 | * gfs2_flock - acquire/release a flock lock on a file |
| 586 | * @file: the file pointer |
| 587 | * @cmd: either modify or retrieve lock state, possibly wait |
| 588 | * @fl: type and range of lock |
| 589 | * |
| 590 | * Returns: errno |
| 591 | */ |
| 592 | |
| 593 | static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl) |
| 594 | { |
Steven Whitehouse | feaa7bb | 2006-06-14 15:32:57 -0400 | [diff] [blame] | 595 | struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); |
| 596 | struct gfs2_sbd *sdp = GFS2_SB(file->f_mapping->host); |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 597 | |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 598 | if (!(fl->fl_flags & FL_FLOCK)) |
| 599 | return -ENOLCK; |
| 600 | if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID) |
| 601 | return -ENOLCK; |
| 602 | |
| 603 | if (sdp->sd_args.ar_localflocks) |
| 604 | return flock_lock_file_wait(file, fl); |
| 605 | |
| 606 | if (fl->fl_type == F_UNLCK) { |
| 607 | do_unflock(file, fl); |
| 608 | return 0; |
Steven Whitehouse | d00223f | 2006-10-02 10:28:05 -0400 | [diff] [blame^] | 609 | } else { |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 610 | return do_flock(file, cmd, fl); |
Steven Whitehouse | d00223f | 2006-10-02 10:28:05 -0400 | [diff] [blame^] | 611 | } |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 612 | } |
| 613 | |
Steven Whitehouse | b0dd930 | 2006-07-03 13:47:02 -0400 | [diff] [blame] | 614 | const struct file_operations gfs2_file_fops = { |
Steven Whitehouse | 26c1a57 | 2006-09-04 15:32:10 -0400 | [diff] [blame] | 615 | .llseek = gfs2_llseek, |
Steven Whitehouse | d00223f | 2006-10-02 10:28:05 -0400 | [diff] [blame^] | 616 | .read = do_sync_read, |
Steven Whitehouse | 26c1a57 | 2006-09-04 15:32:10 -0400 | [diff] [blame] | 617 | .aio_read = generic_file_aio_read, |
Steven Whitehouse | d00223f | 2006-10-02 10:28:05 -0400 | [diff] [blame^] | 618 | .write = do_sync_write, |
Steven Whitehouse | 26c1a57 | 2006-09-04 15:32:10 -0400 | [diff] [blame] | 619 | .aio_write = generic_file_aio_write, |
| 620 | .unlocked_ioctl = gfs2_ioctl, |
| 621 | .mmap = gfs2_mmap, |
| 622 | .open = gfs2_open, |
| 623 | .release = gfs2_close, |
| 624 | .fsync = gfs2_fsync, |
| 625 | .lock = gfs2_lock, |
| 626 | .sendfile = generic_file_sendfile, |
| 627 | .flock = gfs2_flock, |
| 628 | .splice_read = generic_file_splice_read, |
| 629 | .splice_write = generic_file_splice_write, |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 630 | }; |
| 631 | |
Steven Whitehouse | b0dd930 | 2006-07-03 13:47:02 -0400 | [diff] [blame] | 632 | const struct file_operations gfs2_dir_fops = { |
Steven Whitehouse | 26c1a57 | 2006-09-04 15:32:10 -0400 | [diff] [blame] | 633 | .readdir = gfs2_readdir, |
| 634 | .unlocked_ioctl = gfs2_ioctl, |
| 635 | .open = gfs2_open, |
| 636 | .release = gfs2_close, |
| 637 | .fsync = gfs2_fsync, |
| 638 | .lock = gfs2_lock, |
| 639 | .flock = gfs2_flock, |
David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame] | 640 | }; |
| 641 | |