1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * This code is issued under the GNU General Public License.
7 * See the file COPYING in this distribution
9 * Copyright (C) 1992, 1993, 1994, 1995
10 * Remy Card (card@masi.ibp.fr)
11 * Laboratoire MASI - Institut Blaise Pascal
12 * Universite Pierre et Marie Curie (Paris VI)
16 * linux/fs/minix/file.c
18 * Copyright (C) 1991, 1992 Linus Torvalds
20 * ext2 fs regular file handling primitives
22 * 64-bit file support on 64-bit platforms by Jakub Jelinek
23 * (jj@sunsite.ms.mff.cuni.cz)
26 #define DEBUG_SUBSYSTEM S_LLITE
28 #include <linux/lustre_dlm.h>
29 #include <linux/lustre_lite.h>
30 #include <linux/obd_lov.h> /* for lov_mds_md_size() in lov_setstripe() */
31 #include <linux/random.h>
33 int ll_inode_setattr(struct inode *inode, struct iattr *attr, int do_trunc);
34 extern int ll_setattr(struct dentry *de, struct iattr *attr);
36 int ll_create_objects(struct super_block *sb, obd_id id, uid_t uid, gid_t gid,
37 struct lov_stripe_md **lsmp)
47 oa->o_mode = S_IFREG | 0600;
51 oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE |
52 OBD_MD_FLUID | OBD_MD_FLGID;
53 rc = obd_create(ll_s2obdconn(sb), oa, lsmp);
57 LASSERT(*lsmp && (*lsmp)->lsm_object_id);
61 static int ll_file_open(struct inode *inode, struct file *file)
63 struct ll_sb_info *sbi = ll_i2sbi(inode);
64 struct ll_inode_info *lli = ll_i2info(inode);
65 struct lustre_handle *conn = ll_i2obdconn(inode);
66 struct ptlrpc_request *req = NULL;
67 struct ll_file_data *fd;
69 struct lov_stripe_md *lsm;
70 struct lov_mds_md *lmm = NULL;
75 LASSERT(!file->private_data);
79 /* delayed create of object (intent created inode) */
80 /* XXX object needs to be cleaned up if mdc_open fails */
81 /* XXX error handling appropriate here? */
83 if (file->f_flags & O_LOV_DELAY_CREATE) {
84 CDEBUG(D_INODE, "delaying object creation\n");
87 down(&lli->lli_open_sem);
88 /* Check to see if we lost the race */
90 rc = ll_create_objects(inode->i_sb, inode->i_ino, 0, 0,
92 up(&lli->lli_open_sem);
99 /* XXX We should only send this to MDS if we just created these
100 * objects, except we also need to handle the user-stripe case.
102 rc = obd_packmd(conn, &lmm, lli->lli_smd);
108 fd = kmem_cache_alloc(ll_file_data_slab, SLAB_KERNEL);
111 obd_free_wiremd(conn, &lmm);
112 GOTO(out, rc = -ENOMEM);
114 memset(fd, 0, sizeof(*fd));
116 fd->fd_mdshandle.addr = (__u64)(unsigned long)file;
117 get_random_bytes(&fd->fd_mdshandle.cookie,
118 sizeof(fd->fd_mdshandle.cookie));
119 rc = mdc_open(&sbi->ll_mdc_conn, inode->i_ino, S_IFREG | inode->i_mode,
120 file->f_flags, lmm, lmm_size, &fd->fd_mdshandle, &req);
122 obd_free_wiremd(conn, &lmm);
125 /* This is the "reply" refcount. */
126 ptlrpc_req_finished(req);
128 GOTO(out_req, -abs(rc));
129 if (!fd->fd_mdshandle.addr ||
130 fd->fd_mdshandle.addr == (__u64)(unsigned long)file) {
131 CERROR("hmm, mdc_open didn't assign fd_mdshandle?\n");
132 /* XXX handle this how, abort or is it non-fatal? */
137 GOTO(out_mdc, rc = -EINVAL);
139 oa->o_id = lsm->lsm_object_id;
140 oa->o_mode = S_IFREG;
141 oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLSIZE |
143 rc = obd_open(ll_i2obdconn(inode), oa, lsm);
144 obdo_to_inode(inode, oa, oa->o_valid & (OBD_MD_FLSIZE|OBD_MD_FLBLOCKS));
146 obd_oa2handle(&fd->fd_osthandle, oa);
150 GOTO(out_mdc, rc = -abs(rc));
152 atomic_inc(&lli->lli_open_count);
154 file->private_data = fd;
158 mdc_close(&sbi->ll_mdc_conn, inode->i_ino,
159 S_IFREG, &fd->fd_mdshandle, &req);
161 ptlrpc_req_finished(req); /* once for reply */
162 ptlrpc_req_finished(req); /* once for an early "commit" */
164 fd->fd_mdshandle.cookie = DEAD_HANDLE_MAGIC;
165 kmem_cache_free(ll_file_data_slab, fd);
170 int ll_size_lock(struct inode *inode, struct lov_stripe_md *lsm, obd_off start,
171 int mode, struct lustre_handle **lockhs_p)
173 struct ll_sb_info *sbi = ll_i2sbi(inode);
174 struct ldlm_extent extent;
175 struct lustre_handle *lockhs = NULL;
176 int rc, flags = 0, stripe_count;
179 if (sbi->ll_flags & LL_SBI_NOLCK) {
184 stripe_count = lsm->lsm_stripe_count;
188 OBD_ALLOC(lockhs, stripe_count * sizeof(*lockhs));
192 extent.start = start;
193 extent.end = OBD_OBJECT_EOF;
195 rc = obd_enqueue(&sbi->ll_osc_conn, lsm, NULL, LDLM_EXTENT, &extent,
196 sizeof(extent), mode, &flags, ll_lock_callback,
197 inode, sizeof(*inode), lockhs);
198 if (rc != ELDLM_OK) {
199 CERROR("lock enqueue: %d\n", rc);
200 OBD_FREE(lockhs, stripe_count * sizeof(*lockhs));
206 int ll_size_unlock(struct inode *inode, struct lov_stripe_md *lsm, int mode,
207 struct lustre_handle *lockhs)
209 struct ll_sb_info *sbi = ll_i2sbi(inode);
210 int rc, stripe_count;
213 if (sbi->ll_flags & LL_SBI_NOLCK)
216 if (lockhs == NULL) {
221 rc = obd_cancel(&sbi->ll_osc_conn, lsm, mode, lockhs);
222 if (rc != ELDLM_OK) {
223 CERROR("lock cancel: %d\n", rc);
227 stripe_count = lsm->lsm_stripe_count;
231 OBD_FREE(lockhs, stripe_count * sizeof(*lockhs));
235 int ll_file_size(struct inode *inode, struct lov_stripe_md *lsm)
237 struct ll_sb_info *sbi = ll_i2sbi(inode);
238 struct lustre_handle *lockhs;
246 rc = ll_size_lock(inode, lsm, 0, LCK_PR, &lockhs);
247 if (rc != ELDLM_OK) {
248 CERROR("lock enqueue: %d\n", rc);
252 oa.o_id = lsm->lsm_object_id;
254 oa.o_valid = OBD_MD_FLID|OBD_MD_FLTYPE|OBD_MD_FLSIZE|OBD_MD_FLBLOCKS;
255 rc = obd_getattr(&sbi->ll_osc_conn, &oa, lsm);
257 obdo_to_inode(inode, &oa,
258 oa.o_valid & ~(OBD_MD_FLTYPE | OBD_MD_FLMODE));
260 err = ll_size_unlock(inode, lsm, LCK_PR, lockhs);
261 if (err != ELDLM_OK) {
262 CERROR("lock cancel: %d\n", err);
268 static int ll_file_release(struct inode *inode, struct file *file)
270 struct ptlrpc_request *req = NULL;
271 struct ll_file_data *fd;
273 struct ll_sb_info *sbi = ll_i2sbi(inode);
274 struct ll_inode_info *lli = ll_i2info(inode);
275 struct lov_stripe_md *lsm = lli->lli_smd;
280 fd = (struct ll_file_data *)file->private_data;
282 LASSERT(file->f_flags & O_LOV_DELAY_CREATE);
286 memset(&oa, 0, sizeof(oa));
287 oa.o_id = lsm->lsm_object_id;
289 oa.o_valid = OBD_MD_FLTYPE | OBD_MD_FLID;
290 obd_handle2oa(&oa, &fd->fd_osthandle);
291 rc = obd_close(ll_i2obdconn(inode), &oa, lsm);
293 GOTO(out_mdc, rc = -abs(rc));
296 #error "This should only be done on the node that already has the EOF lock"
297 #error "and only in the case where the file size actually changed. For now"
298 #error "we don't care about the size on the MDS, since we never use it (the"
299 #error "OST always has the authoritative size and we don't even use the MDS."
300 /* If this fails and we goto out_fd, the file size on the MDS is out of
301 * date. Is that a big deal? */
302 if (file->f_mode & FMODE_WRITE) {
303 struct lustre_handle *lockhs;
305 rc = ll_size_lock(inode, lsm, 0, LCK_PR, &lockhs);
307 GOTO(out_mdc, -abs(rc));
309 oa.o_id = lsm->lsm_object_id;
311 oa.o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLSIZE |
313 rc = obd_getattr(&sbi->ll_osc_conn, &oa, lsm);
316 attr.ia_valid = (ATTR_MTIME | ATTR_CTIME | ATTR_ATIME |
318 attr.ia_mtime = inode->i_mtime;
319 attr.ia_ctime = inode->i_ctime;
320 attr.ia_atime = inode->i_atime;
321 attr.ia_size = oa.o_size;
323 inode->i_blocks = oa.o_blocks;
325 /* XXX: this introduces a small race that we should
327 rc = ll_inode_setattr(inode, &attr, 0);
329 rc2 = ll_size_unlock(inode, lli->lli_smd, LCK_PR, lockhs);
331 CERROR("lock cancel: %d\n", rc);
340 rc2 = mdc_close(&sbi->ll_mdc_conn, inode->i_ino,
341 S_IFREG, &fd->fd_mdshandle, &req);
342 ptlrpc_req_finished(req);
348 DEBUG_REQ(D_HA, fd->fd_req, "matched open for this close: ");
349 ptlrpc_req_finished(fd->fd_req);
351 if (atomic_dec_and_test(&lli->lli_open_count)) {
352 CDEBUG(D_INFO, "last close, cancelling unused locks\n");
353 rc = obd_cancel_unused(ll_i2obdconn(inode), lsm, 0);
355 CERROR("obd_cancel_unused: %d\n", rc);
357 CDEBUG(D_INFO, "not last close, not cancelling unused locks\n");
363 fd->fd_mdshandle.cookie = DEAD_HANDLE_MAGIC;
364 file->private_data = NULL;
365 kmem_cache_free(ll_file_data_slab, fd);
370 static inline void ll_remove_suid(struct inode *inode)
374 /* set S_IGID if S_IXGRP is set, and always set S_ISUID */
375 mode = (inode->i_mode & S_IXGRP)*(S_ISGID/S_IXGRP) | S_ISUID;
377 /* was any of the uid bits set? */
378 mode &= inode->i_mode;
379 if (mode && !capable(CAP_FSETID)) {
380 inode->i_mode &= ~mode;
381 // XXX careful here - we cannot change the size
385 static void ll_update_atime(struct inode *inode)
389 attr.ia_atime = CURRENT_TIME;
390 attr.ia_valid = ATTR_ATIME;
392 if (inode->i_atime == attr.ia_atime) return;
393 if (IS_RDONLY(inode)) return;
394 if (IS_NOATIME(inode)) return;
396 /* ll_inode_setattr() sets inode->i_atime from attr.ia_atime */
397 ll_inode_setattr(inode, &attr, 0);
400 int ll_lock_callback(struct ldlm_lock *lock, struct ldlm_lock_desc *new,
401 void *data, __u32 data_len, int flag)
403 struct inode *inode = data;
404 struct lustre_handle lockh;
408 if (data_len != sizeof(struct inode))
415 case LDLM_CB_BLOCKING:
416 ldlm_lock2handle(lock, &lockh);
417 rc = ldlm_cli_cancel(&lockh);
419 CERROR("ldlm_cli_cancel failed: %d\n", rc);
421 case LDLM_CB_CANCELING:
422 CDEBUG(D_INODE, "invalidating obdo/inode %lu\n", inode->i_ino);
423 /* FIXME: do something better than throwing away everything */
424 //down(&inode->i_sem);
425 ll_invalidate_inode_pages(inode);
435 static ssize_t ll_file_read(struct file *filp, char *buf, size_t count,
438 struct ll_file_data *fd = (struct ll_file_data *)filp->private_data;
439 struct inode *inode = filp->f_dentry->d_inode;
440 struct ll_sb_info *sbi = ll_i2sbi(inode);
441 struct lustre_handle *lockhs = NULL;
442 struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
448 /* If we don't refresh the file size, generic_file_read may not even
450 retval = ll_file_size(inode, lsm);
452 CERROR("ll_file_size: %d\n", retval);
456 if (!(fd->fd_flags & LL_FILE_IGNORE_LOCK) &&
457 !(sbi->ll_flags & LL_SBI_NOLCK)) {
458 struct ldlm_extent extent;
459 OBD_ALLOC(lockhs, lsm->lsm_stripe_count * sizeof(*lockhs));
463 extent.start = *ppos;
464 extent.end = *ppos + count;
465 CDEBUG(D_INFO, "Locking inode %lu, start "LPU64" end "LPU64"\n",
466 inode->i_ino, extent.start, extent.end);
468 err = obd_enqueue(&sbi->ll_osc_conn, lsm, NULL, LDLM_EXTENT,
469 &extent, sizeof(extent), LCK_PR, &flags,
470 ll_lock_callback, inode, sizeof(*inode),
472 if (err != ELDLM_OK) {
473 OBD_FREE(lockhs, lsm->lsm_stripe_count*sizeof(*lockhs));
474 CERROR("lock enqueue: err: %d\n", err);
479 CDEBUG(D_INFO, "Reading inode %lu, %d bytes, offset %Ld\n",
480 inode->i_ino, count, *ppos);
481 retval = generic_file_read(filp, buf, count, ppos);
484 ll_update_atime(inode);
486 if (!(fd->fd_flags & LL_FILE_IGNORE_LOCK) &&
487 !(sbi->ll_flags & LL_SBI_NOLCK)) {
488 err = obd_cancel(&sbi->ll_osc_conn, lsm, LCK_PR, lockhs);
489 if (err != ELDLM_OK) {
490 CERROR("lock cancel: err: %d\n", err);
496 OBD_FREE(lockhs, lsm->lsm_stripe_count * sizeof(*lockhs));
501 * Write to a file (through the page cache).
504 ll_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
506 struct ll_file_data *fd = (struct ll_file_data *)file->private_data;
507 struct inode *inode = file->f_dentry->d_inode;
508 struct ll_sb_info *sbi = ll_i2sbi(inode);
509 struct lustre_handle *lockhs = NULL, *eof_lockhs = NULL;
510 struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
516 if (!S_ISBLK(inode->i_mode) && file->f_flags & O_APPEND) {
523 err = ll_size_lock(inode, lsm, 0, LCK_PW, &eof_lockhs);
529 oa->o_id = lsm->lsm_object_id;
530 oa->o_mode = inode->i_mode;
531 oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLSIZE |
533 obd_handle2oa(oa, &fd->fd_osthandle);
534 retval = obd_getattr(&sbi->ll_osc_conn, oa, lsm);
537 GOTO(out_eof, retval);
541 obdo_to_inode(inode, oa, oa->o_valid);
545 if (!(fd->fd_flags & LL_FILE_IGNORE_LOCK) &&
546 !(sbi->ll_flags & LL_SBI_NOLCK)) {
547 struct ldlm_extent extent;
548 OBD_ALLOC(lockhs, lsm->lsm_stripe_count * sizeof(*lockhs));
550 GOTO(out_eof, retval = -ENOMEM);
551 extent.start = *ppos;
552 extent.end = *ppos + count;
553 CDEBUG(D_INFO, "Locking inode %lu, start "LPU64" end "LPU64"\n",
554 inode->i_ino, extent.start, extent.end);
556 err = obd_enqueue(&sbi->ll_osc_conn, lsm, NULL, LDLM_EXTENT,
557 &extent, sizeof(extent), LCK_PW, &flags,
558 ll_lock_callback, inode, sizeof(*inode),
560 if (err != ELDLM_OK) {
561 CERROR("lock enqueue: err: %d\n", err);
562 GOTO(out_free, retval = err);
566 CDEBUG(D_INFO, "Writing inode %lu, %ld bytes, offset "LPD64"\n",
567 inode->i_ino, (long)count, *ppos);
569 retval = generic_file_write(file, buf, count, ppos);
571 if (!(fd->fd_flags & LL_FILE_IGNORE_LOCK) ||
572 sbi->ll_flags & LL_SBI_NOLCK) {
573 err = obd_cancel(&sbi->ll_osc_conn, lsm, LCK_PW, lockhs);
574 if (err != ELDLM_OK) {
575 CERROR("lock cancel: err: %d\n", err);
576 GOTO(out_free, retval = err);
583 OBD_FREE(lockhs, lsm->lsm_stripe_count * sizeof(*lockhs));
586 if (!S_ISBLK(inode->i_mode) && file->f_flags & O_APPEND) {
587 err = ll_size_unlock(inode, lsm, LCK_PW, eof_lockhs);
595 /* Retrieve object striping information.
597 * @arg is a pointer to a user struct with one or more of the fields set to
598 * indicate the application preference: lmm_stripe_count, lmm_stripe_size,
599 * lmm_stripe_offset, and lmm_stripe_pattern. lmm_magic must be LOV_MAGIC.
601 static int ll_lov_setstripe(struct inode *inode, struct file *file,
604 struct ll_inode_info *lli = ll_i2info(inode);
605 struct lov_mds_md *lmm = NULL, *lmmu = (void *)arg;
606 struct lustre_handle *conn = ll_i2obdconn(inode);
609 rc = obd_alloc_wiremd(conn, &lmm);
613 rc = copy_from_user(lmm, lmmu, sizeof(*lmm));
615 GOTO(out_free, rc = -EFAULT);
617 if (lmm->lmm_magic != LOV_MAGIC) {
618 CERROR("bad LOV magic %X\n", lmm->lmm_magic);
619 GOTO(out_free, rc = -EINVAL);
622 down(&lli->lli_open_sem);
624 CERROR("striping data already set for %lu\n", inode->i_ino);
625 GOTO(out_lov_up, rc = -EPERM);
627 rc = obd_unpackmd(conn, &lli->lli_smd, lmm);
629 CERROR("error setting LOV striping on %lu: rc = %d\n",
631 GOTO(out_lov_up, rc);
634 rc = ll_create_objects(inode->i_sb, inode->i_ino, 0, 0, &lli->lli_smd);
636 obd_free_memmd(conn, &lli->lli_smd);
638 file->f_flags &= ~O_LOV_DELAY_CREATE;
639 rc = ll_file_open(inode, file);
642 up(&lli->lli_open_sem);
644 obd_free_wiremd(conn, &lmm);
648 /* Retrieve object striping information.
650 * @arg is a pointer to a user struct with lmm_ost_count indicating
651 * the maximum number of OST indices which will fit in the user buffer.
652 * lmm_magic must be LOV_MAGIC.
654 static int ll_lov_getstripe(struct inode *inode, unsigned long arg)
656 struct lov_mds_md lmm, *lmmu = (void *)arg, *lmmk = NULL;
657 struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
658 struct lustre_handle *conn = ll_i2obdconn(inode);
659 int ost_count, rc, lmm_size;
664 rc = copy_from_user(&lmm, lmmu, sizeof(lmm));
668 if (lmm.lmm_magic != LOV_MAGIC)
671 if (lsm->lsm_stripe_count == 0)
674 struct obd_device *obd = class_conn2obd(conn);
675 struct lov_obd *lov = &obd->u.lov;
676 ost_count = lov->desc.ld_tgt_count;
679 /* XXX we _could_ check if indices > user lmm_ost_count are zero */
680 if (lmm.lmm_ost_count < ost_count)
683 rc = obd_packmd(conn, &lmmk, lsm);
689 /* LOV STACKING layering violation to make LOV/OSC return same data */
690 if (lsm->lsm_stripe_count == 0) {
691 struct lov_object_id *loi;
693 loi = (void *)lmmu + offsetof(typeof(*lmmu), lmm_objects);
694 rc = copy_to_user(loi, &lsm->lsm_object_id, sizeof(*loi));
699 lmmk->lmm_magic = LOV_MAGIC;
700 lmmk->lmm_ost_count = lmmk->lmm_stripe_count = 1;
704 if (lmm_size && copy_to_user(lmmu, lmmk, lmm_size))
707 obd_free_wiremd(conn, &lmmk);
712 int ll_file_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
715 struct ll_file_data *fd = (struct ll_file_data *)file->private_data;
716 struct lustre_handle *conn;
720 case LL_IOC_GETFLAGS:
721 /* Get the current value of the file flags */
722 return put_user(fd->fd_flags, (int *)arg);
723 case LL_IOC_SETFLAGS:
724 case LL_IOC_CLRFLAGS:
725 /* Set or clear specific file flags */
726 /* XXX This probably needs checks to ensure the flags are
727 * not abused, and to handle any flag side effects.
729 if (get_user(flags, (int *) arg))
732 if (cmd == LL_IOC_SETFLAGS)
733 fd->fd_flags |= flags;
735 fd->fd_flags &= ~flags;
737 case LL_IOC_LOV_SETSTRIPE:
738 return ll_lov_setstripe(inode, file, arg);
739 case LL_IOC_LOV_GETSTRIPE:
740 return ll_lov_getstripe(inode, arg);
742 /* We need to special case any other ioctls we want to handle,
743 * to send them to the MDS/OST as appropriate and to properly
744 * network encode the arg field.
745 case EXT2_IOC_GETFLAGS:
746 case EXT2_IOC_SETFLAGS:
747 case EXT2_IOC_GETVERSION_OLD:
748 case EXT2_IOC_GETVERSION_NEW:
749 case EXT2_IOC_SETVERSION_OLD:
750 case EXT2_IOC_SETVERSION_NEW:
753 conn = ll_i2obdconn(inode);
754 return obd_iocontrol(cmd, conn, 0, NULL, (void *)arg);
758 loff_t ll_file_seek(struct file *file, loff_t offset, int origin)
760 struct inode *inode = file->f_dentry->d_inode;
766 struct ll_inode_info *lli = ll_i2info(inode);
768 retval = ll_file_size(inode, lli->lli_smd);
772 offset += inode->i_size;
776 offset += file->f_pos;
779 if (offset >= 0 && offset <= inode->i_sb->s_maxbytes) {
780 if (offset != file->f_pos) {
781 file->f_pos = offset;
782 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
785 file->f_version = ++event;
792 /* XXX this does not need to do anything for data, it _does_ need to
794 int ll_fsync(struct file *file, struct dentry *dentry, int data)
801 static int ll_inode_revalidate(struct dentry *dentry)
803 struct inode *inode = dentry->d_inode;
804 struct lov_stripe_md *lsm;
808 CERROR("REPORT THIS LINE TO PETER\n");
812 if (!ll_have_md_lock(dentry)) {
813 struct ptlrpc_request *req = NULL;
814 struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode);
815 struct mds_body *body;
816 unsigned long valid = 0;
820 if (S_ISREG(inode->i_mode)) {
821 datalen = obd_size_wiremd(&sbi->ll_osc_conn, NULL);
822 valid |= OBD_MD_FLEASIZE;
824 rc = mdc_getattr(&sbi->ll_mdc_conn, inode->i_ino,
825 inode->i_mode, valid, datalen, &req);
827 CERROR("failure %d inode "LPX64"\n", rc, inode->i_ino);
828 ptlrpc_req_finished(req);
832 body = lustre_msg_buf(req->rq_repmsg, 0);
833 ll_update_inode(inode, body);
834 ptlrpc_req_finished(req);
837 lsm = ll_i2info(inode)->lli_smd;
838 if (!lsm) /* object not yet allocated, don't validate size */
841 RETURN(ll_file_size(inode, lsm));
844 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
845 static int ll_getattr(struct vfsmount *mnt, struct dentry *de,
848 return ll_inode_revalidate(de);
852 struct file_operations ll_file_operations = {
854 write: ll_file_write,
855 ioctl: ll_file_ioctl,
857 release: ll_file_release,
858 mmap: generic_file_mmap,
859 llseek: ll_file_seek,
863 struct inode_operations ll_file_inode_operations = {
865 truncate: ll_truncate,
866 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
869 revalidate: ll_inode_revalidate,