Whamcloud - gitweb
LU-2430 mdd: add lfs mv to migrate inode.
[fs/lustre-release.git] / lustre / ofd / ofd_objects.c
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
19  *
20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21  * CA 95054 USA or visit www.sun.com if you need additional information or
22  * have any questions.
23  *
24  * GPL HEADER END
25  */
26 /*
27  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
28  * Use is subject to license terms.
29  *
30  * Copyright (c) 2012, 2013, Intel Corporation.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  *
36  * lustre/ofd/ofd_objects.c
37  *
38  * Author: Alex Zhuravlev <bzzz@whamcloud.com>
39  * Author: Mikhail Pershin <tappro@whamcloud.com>
40  */
41
42 #define DEBUG_SUBSYSTEM S_FILTER
43
44 #include <dt_object.h>
45 #include <lustre/lustre_idl.h>
46 #include <lustre_lfsck.h>
47
48 #include "ofd_internal.h"
49
50 int ofd_version_get_check(struct ofd_thread_info *info,
51                           struct ofd_object *fo)
52 {
53         dt_obj_version_t curr_version;
54
55         LASSERT(ofd_object_exists(fo));
56         LASSERT(info->fti_exp);
57
58         curr_version = dt_version_get(info->fti_env, ofd_object_child(fo));
59         if ((__s64)curr_version == -EOPNOTSUPP)
60                 RETURN(0);
61         /* VBR: version is checked always because costs nothing */
62         if (info->fti_pre_version != 0 &&
63             info->fti_pre_version != curr_version) {
64                 CDEBUG(D_INODE, "Version mismatch "LPX64" != "LPX64"\n",
65                        info->fti_pre_version, curr_version);
66                 spin_lock(&info->fti_exp->exp_lock);
67                 info->fti_exp->exp_vbr_failed = 1;
68                 spin_unlock(&info->fti_exp->exp_lock);
69                 RETURN (-EOVERFLOW);
70         }
71         info->fti_pre_version = curr_version;
72         RETURN(0);
73 }
74
75 struct ofd_object *ofd_object_find(const struct lu_env *env,
76                                    struct ofd_device *ofd,
77                                    const struct lu_fid *fid)
78 {
79         struct ofd_object *fo;
80         struct lu_object  *o;
81
82         ENTRY;
83
84         o = lu_object_find(env, &ofd->ofd_dt_dev.dd_lu_dev, fid, NULL);
85         if (likely(!IS_ERR(o)))
86                 fo = ofd_obj(o);
87         else
88                 fo = ERR_CAST(o); /* return error */
89
90         RETURN(fo);
91 }
92
93 struct ofd_object *ofd_object_find_or_create(const struct lu_env *env,
94                                              struct ofd_device *ofd,
95                                              const struct lu_fid *fid,
96                                              struct lu_attr *attr)
97 {
98         struct ofd_thread_info  *info = ofd_info(env);
99         struct lu_object        *fo_obj;
100         struct dt_object        *dto;
101
102         ENTRY;
103
104         info->fti_dof.dof_type = dt_mode_to_dft(S_IFREG);
105
106         dto = dt_find_or_create(env, ofd->ofd_osd, fid, &info->fti_dof, attr);
107         if (IS_ERR(dto))
108                 RETURN(ERR_CAST(dto));
109
110         fo_obj = lu_object_locate(dto->do_lu.lo_header,
111                                   ofd->ofd_dt_dev.dd_lu_dev.ld_type);
112         RETURN(ofd_obj(fo_obj));
113 }
114
115 int ofd_object_ff_check(const struct lu_env *env, struct ofd_object *fo)
116 {
117         int rc = 0;
118
119         ENTRY;
120
121         if (!fo->ofo_ff_exists) {
122                 /*
123                  * This actually means that we don't know whether the object
124                  * has the "fid" EA or not.
125                  */
126                 rc = dt_xattr_get(env, ofd_object_child(fo), &LU_BUF_NULL,
127                                   XATTR_NAME_FID, BYPASS_CAPA);
128                 if (rc >= 0 || rc == -ENODATA) {
129                         /*
130                          * Here we assume that, if the object doesn't have the
131                          * "fid" EA, the caller will add one, unless a fatal
132                          * error (e.g., a memory or disk failure) prevents it
133                          * from doing so.
134                          */
135                         fo->ofo_ff_exists = 1;
136                 }
137                 if (rc > 0)
138                         rc = 0;
139         }
140         RETURN(rc);
141 }
142
143 void ofd_object_put(const struct lu_env *env, struct ofd_object *fo)
144 {
145         lu_object_put(env, &fo->ofo_obj.do_lu);
146 }
147
148 int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd,
149                           obd_id id, struct ofd_seq *oseq, int nr, int sync)
150 {
151         struct ofd_thread_info  *info = ofd_info(env);
152         struct ofd_object       *fo = NULL;
153         struct dt_object        *next;
154         struct thandle          *th;
155         struct ofd_object       **batch;
156         struct lu_fid           *fid = &info->fti_fid;
157         obd_id                   tmp;
158         int                      rc;
159         int                      i;
160         int                      objects = 0;
161         int                      nr_saved = nr;
162
163         ENTRY;
164
165         /* Don't create objects beyond the valid range for this SEQ */
166         if (unlikely(fid_seq_is_mdt0(ostid_seq(&oseq->os_oi)) &&
167                      (id + nr) >= IDIF_MAX_OID)) {
168                 CERROR("%s:"DOSTID" hit the IDIF_MAX_OID (1<<48)!\n",
169                        ofd_name(ofd), id, ostid_seq(&oseq->os_oi));
170                 RETURN(rc = -ENOSPC);
171         } else if (unlikely(!fid_seq_is_mdt0(ostid_seq(&oseq->os_oi)) &&
172                             (id + nr) >= OBIF_MAX_OID)) {
173                 CERROR("%s:"DOSTID" hit the OBIF_MAX_OID (1<<32)!\n",
174                        ofd_name(ofd), id, ostid_seq(&oseq->os_oi));
175                 RETURN(rc = -ENOSPC);
176         }
177
178         OBD_ALLOC(batch, nr_saved * sizeof(struct ofd_object *));
179         if (batch == NULL)
180                 RETURN(-ENOMEM);
181
182         info->fti_attr.la_valid = LA_TYPE | LA_MODE;
183         /*
184          * We mark object SUID+SGID to flag it for accepting UID+GID from
185          * client on first write.  Currently the permission bits on the OST are
186          * never used, so this is OK.
187          */
188         info->fti_attr.la_mode = S_IFREG | S_ISUID | S_ISGID | 0666;
189         info->fti_dof.dof_type = dt_mode_to_dft(S_IFREG);
190
191         /* Initialize a/c/m time so any client timestamp will always
192          * be newer and update the inode. ctime = 0 is also handled
193          * specially in osd_inode_setattr(). See LU-221, LU-1042 */
194         info->fti_attr.la_valid |= LA_ATIME | LA_MTIME | LA_CTIME;
195         info->fti_attr.la_atime = 0;
196         info->fti_attr.la_mtime = 0;
197         info->fti_attr.la_ctime = 0;
198
199         LASSERT(id != 0);
200
201         /* prepare objects */
202         *fid = *lu_object_fid(&oseq->os_lastid_obj->do_lu);
203         for (i = 0; i < nr; i++) {
204                 rc = fid_set_id(fid, id + i);
205                 if (rc != 0) {
206                         if (i == 0)
207                                 GOTO(out, rc);
208
209                         nr = i;
210                         break;
211                 }
212
213                 fo = ofd_object_find(env, ofd, fid);
214                 if (IS_ERR(fo)) {
215                         if (i == 0)
216                                 GOTO(out, rc = PTR_ERR(fo));
217
218                         nr = i;
219                         break;
220                 }
221
222                 ofd_write_lock(env, fo);
223                 batch[i] = fo;
224         }
225         info->fti_buf.lb_buf = &tmp;
226         info->fti_buf.lb_len = sizeof(tmp);
227         info->fti_off = 0;
228
229         th = ofd_trans_create(env, ofd);
230         if (IS_ERR(th))
231                 GOTO(out, rc = PTR_ERR(th));
232
233         th->th_sync |= sync;
234
235         rc = dt_declare_record_write(env, oseq->os_lastid_obj, &info->fti_buf,
236                                      info->fti_off, th);
237         if (rc)
238                 GOTO(trans_stop, rc);
239
240         for (i = 0; i < nr; i++) {
241                 fo = batch[i];
242                 LASSERT(fo);
243
244                 if (unlikely(ofd_object_exists(fo))) {
245                         /* object may exist being re-created by write replay */
246                         CDEBUG(D_INODE, "object "LPX64"/"LPX64" exists: "
247                                DFID"\n", ostid_seq(&oseq->os_oi), id,
248                                PFID(lu_object_fid(&fo->ofo_obj.do_lu)));
249                         continue;
250                 }
251
252                 next = ofd_object_child(fo);
253                 LASSERT(next != NULL);
254
255                 rc = dt_declare_create(env, next, &info->fti_attr, NULL,
256                                        &info->fti_dof, th);
257                 if (rc) {
258                         nr = i;
259                         break;
260                 }
261         }
262
263         rc = dt_trans_start_local(env, ofd->ofd_osd, th);
264         if (rc)
265                 GOTO(trans_stop, rc);
266
267         CDEBUG(D_OTHER, "%s: create new object "DFID" nr %d\n",
268                ofd_name(ofd), PFID(fid), nr);
269
270         LASSERT(nr > 0);
271
272          /* When the LFSCK scanning the whole device to verify the LAST_ID file
273           * consistency, it will load the last_id into RAM firstly, and compare
274           * the last_id with each OST-object's ID. If the later one is larger,
275           * then it will regard the LAST_ID file crashed. But during the LFSCK
276           * scanning, the OFD may continue to create new OST-objects. Those new
277           * created OST-objects will have larger IDs than the LFSCK known ones.
278           * So from the LFSCK view, it needs to re-load the last_id from disk
279           * file, and if the latest last_id is still smaller than the object's
280           * ID, then the LAST_ID file is real crashed.
281           *
282           * To make above mechanism to work, before OFD pre-create OST-objects,
283           * it needs to update the LAST_ID file firstly, otherwise, the LFSCK
284           * may cannot get latest last_id although new OST-object created. */
285         if (!OBD_FAIL_CHECK(OBD_FAIL_LFSCK_SKIP_LASTID)) {
286                 tmp = cpu_to_le64(id + nr - 1);
287                 dt_write_lock(env, oseq->os_lastid_obj, 0);
288                 rc = dt_record_write(env, oseq->os_lastid_obj,
289                                      &info->fti_buf, &info->fti_off, th);
290                 dt_write_unlock(env, oseq->os_lastid_obj);
291                 if (rc != 0)
292                         GOTO(trans_stop, rc);
293         }
294
295         for (i = 0; i < nr; i++) {
296                 fo = batch[i];
297                 LASSERT(fo);
298
299                 /* Only the new created objects need to be recorded. */
300                 if (ofd->ofd_osd->dd_record_fid_accessed) {
301                         lfsck_pack_rfa(&ofd_info(env)->fti_lr,
302                                        lu_object_fid(&fo->ofo_obj.do_lu));
303                         lfsck_in_notify(env, ofd->ofd_osd,
304                                         &ofd_info(env)->fti_lr);
305                 }
306
307                 if (likely(!ofd_object_exists(fo) &&
308                            !OBD_FAIL_CHECK(OBD_FAIL_LFSCK_DANGLING))) {
309                         next = ofd_object_child(fo);
310                         LASSERT(next != NULL);
311
312                         rc = dt_create(env, next, &info->fti_attr, NULL,
313                                        &info->fti_dof, th);
314                         if (rc)
315                                 break;
316                         LASSERT(ofd_object_exists(fo));
317                 }
318                 ofd_seq_last_oid_set(oseq, id + i);
319         }
320
321         objects = i;
322         /* NOT all the wanted objects have been created,
323          * set the LAST_ID as the real created. */
324         if (unlikely(objects < nr)) {
325                 int rc1;
326
327                 info->fti_off = 0;
328                 tmp = cpu_to_le64(ofd_seq_last_oid(oseq));
329                 dt_write_lock(env, oseq->os_lastid_obj, 0);
330                 rc1 = dt_record_write(env, oseq->os_lastid_obj,
331                                       &info->fti_buf, &info->fti_off, th);
332                 dt_write_unlock(env, oseq->os_lastid_obj);
333                 if (rc1 != 0)
334                         CERROR("%s: fail to reset the LAST_ID for seq ("LPX64
335                                ") from "LPU64" to "LPU64"\n", ofd_name(ofd),
336                                ostid_seq(&oseq->os_oi), id + nr - 1,
337                                ofd_seq_last_oid(oseq));
338         }
339
340 trans_stop:
341         ofd_trans_stop(env, ofd, th, rc);
342 out:
343         for (i = 0; i < nr_saved; i++) {
344                 fo = batch[i];
345                 if (fo) {
346                         ofd_write_unlock(env, fo);
347                         ofd_object_put(env, fo);
348                 }
349         }
350         OBD_FREE(batch, nr_saved * sizeof(struct ofd_object *));
351
352         CDEBUG((objects == 0 && rc == 0) ? D_ERROR : D_OTHER,
353                "created %d/%d objects: %d\n", objects, nr_saved, rc);
354
355         LASSERT(ergo(objects == 0, rc < 0));
356         RETURN(objects > 0 ? objects : rc);
357 }
358
359 /*
360  * If the object still has SUID+SGID bits set (see ofd_precreate_object()) then
361  * we will accept the UID+GID if sent by the client for initializing the
362  * ownership of this object.  We only allow this to happen once (so clear these
363  * bits) and later only allow setattr.
364  */
365 int ofd_attr_handle_ugid(const struct lu_env *env, struct ofd_object *fo,
366                          struct lu_attr *la, int is_setattr)
367 {
368         struct ofd_thread_info  *info = ofd_info(env);
369         struct lu_attr          *ln = &info->fti_attr2;
370         __u32                    mask = 0;
371         int                      rc;
372
373         ENTRY;
374
375         if (!(la->la_valid & LA_UID) && !(la->la_valid & LA_GID))
376                 RETURN(0);
377
378         rc = dt_attr_get(env, ofd_object_child(fo), ln, BYPASS_CAPA);
379         if (rc != 0)
380                 RETURN(rc);
381
382         LASSERT(ln->la_valid & LA_MODE);
383
384         if (!is_setattr) {
385                 if (!(ln->la_mode & S_ISUID))
386                         la->la_valid &= ~LA_UID;
387                 if (!(ln->la_mode & S_ISGID))
388                         la->la_valid &= ~LA_GID;
389         }
390
391         if ((la->la_valid & LA_UID) && (ln->la_mode & S_ISUID))
392                 mask |= S_ISUID;
393         if ((la->la_valid & LA_GID) && (ln->la_mode & S_ISGID))
394                 mask |= S_ISGID;
395         if (mask != 0) {
396                 if (!(la->la_valid & LA_MODE) || !is_setattr) {
397                         la->la_mode = ln->la_mode;
398                         la->la_valid |= LA_MODE;
399                 }
400                 la->la_mode &= ~mask;
401         }
402
403         RETURN(0);
404 }
405
406 int ofd_attr_set(const struct lu_env *env, struct ofd_object *fo,
407                  struct lu_attr *la, struct filter_fid *ff)
408 {
409         struct ofd_thread_info  *info = ofd_info(env);
410         struct ofd_device       *ofd = ofd_obj2dev(fo);
411         struct thandle          *th;
412         struct ofd_mod_data     *fmd;
413         int                      ff_needed = 0;
414         int                      rc;
415         ENTRY;
416
417         ofd_write_lock(env, fo);
418         if (!ofd_object_exists(fo))
419                 GOTO(unlock, rc = -ENOENT);
420
421         if (la->la_valid & (LA_ATIME | LA_MTIME | LA_CTIME)) {
422                 fmd = ofd_fmd_get(info->fti_exp, &fo->ofo_header.loh_fid);
423                 if (fmd && fmd->fmd_mactime_xid < info->fti_xid)
424                         fmd->fmd_mactime_xid = info->fti_xid;
425                 ofd_fmd_put(info->fti_exp, fmd);
426         }
427
428         /* VBR: version recovery check */
429         rc = ofd_version_get_check(info, fo);
430         if (rc)
431                 GOTO(unlock, rc);
432
433         rc = ofd_attr_handle_ugid(env, fo, la, 1 /* is_setattr */);
434         if (rc != 0)
435                 GOTO(unlock, rc);
436
437         if (ff != NULL) {
438                 rc = ofd_object_ff_check(env, fo);
439                 if (rc == -ENODATA)
440                         ff_needed = 1;
441                 else if (rc < 0)
442                         GOTO(unlock, rc);
443         }
444
445         th = ofd_trans_create(env, ofd);
446         if (IS_ERR(th))
447                 GOTO(unlock, rc = PTR_ERR(th));
448
449         rc = dt_declare_attr_set(env, ofd_object_child(fo), la, th);
450         if (rc)
451                 GOTO(stop, rc);
452
453         if (ff_needed) {
454                 info->fti_buf.lb_buf = ff;
455                 info->fti_buf.lb_len = sizeof(*ff);
456                 rc = dt_declare_xattr_set(env, ofd_object_child(fo),
457                                           &info->fti_buf, XATTR_NAME_FID, 0,
458                                           th);
459                 if (rc)
460                         GOTO(stop, rc);
461         }
462
463         rc = ofd_trans_start(env, ofd, la->la_valid & LA_SIZE ? fo : NULL, th);
464         if (rc)
465                 GOTO(stop, rc);
466
467         rc = dt_attr_set(env, ofd_object_child(fo), la, th,
468                          ofd_object_capa(env, fo));
469         if (rc)
470                 GOTO(stop, rc);
471
472         if (ff_needed)
473                 rc = dt_xattr_set(env, ofd_object_child(fo), &info->fti_buf,
474                                   XATTR_NAME_FID, 0, th, BYPASS_CAPA);
475
476 stop:
477         ofd_trans_stop(env, ofd, th, rc);
478 unlock:
479         ofd_write_unlock(env, fo);
480         RETURN(rc);
481 }
482
483 int ofd_object_punch(const struct lu_env *env, struct ofd_object *fo,
484                      __u64 start, __u64 end, struct lu_attr *la,
485                      struct filter_fid *ff)
486 {
487         struct ofd_thread_info  *info = ofd_info(env);
488         struct ofd_device       *ofd = ofd_obj2dev(fo);
489         struct ofd_mod_data     *fmd;
490         struct dt_object        *dob = ofd_object_child(fo);
491         struct thandle          *th;
492         int                      ff_needed = 0;
493         int                      rc;
494
495         ENTRY;
496
497         /* we support truncate, not punch yet */
498         LASSERT(end == OBD_OBJECT_EOF);
499
500         fmd = ofd_fmd_get(info->fti_exp, &fo->ofo_header.loh_fid);
501         if (fmd && fmd->fmd_mactime_xid < info->fti_xid)
502                 fmd->fmd_mactime_xid = info->fti_xid;
503         ofd_fmd_put(info->fti_exp, fmd);
504
505         ofd_write_lock(env, fo);
506         if (!ofd_object_exists(fo))
507                 GOTO(unlock, rc = -ENOENT);
508
509         /* VBR: version recovery check */
510         rc = ofd_version_get_check(info, fo);
511         if (rc)
512                 GOTO(unlock, rc);
513
514         rc = ofd_attr_handle_ugid(env, fo, la, 0 /* !is_setattr */);
515         if (rc != 0)
516                 GOTO(unlock, rc);
517
518         if (ff != NULL) {
519                 rc = ofd_object_ff_check(env, fo);
520                 if (rc == -ENODATA)
521                         ff_needed = 1;
522                 else if (rc < 0)
523                         GOTO(unlock, rc);
524         }
525
526         th = ofd_trans_create(env, ofd);
527         if (IS_ERR(th))
528                 GOTO(unlock, rc = PTR_ERR(th));
529
530         rc = dt_declare_attr_set(env, dob, la, th);
531         if (rc)
532                 GOTO(stop, rc);
533
534         rc = dt_declare_punch(env, dob, start, OBD_OBJECT_EOF, th);
535         if (rc)
536                 GOTO(stop, rc);
537
538         if (ff_needed) {
539                 info->fti_buf.lb_buf = ff;
540                 info->fti_buf.lb_len = sizeof(*ff);
541                 rc = dt_declare_xattr_set(env, ofd_object_child(fo),
542                                           &info->fti_buf, XATTR_NAME_FID, 0,
543                                           th);
544                 if (rc)
545                         GOTO(stop, rc);
546         }
547
548         rc = ofd_trans_start(env, ofd, fo, th);
549         if (rc)
550                 GOTO(stop, rc);
551
552         rc = dt_punch(env, dob, start, OBD_OBJECT_EOF, th,
553                       ofd_object_capa(env, fo));
554         if (rc)
555                 GOTO(stop, rc);
556
557         rc = dt_attr_set(env, dob, la, th, ofd_object_capa(env, fo));
558         if (rc)
559                 GOTO(stop, rc);
560
561         if (ff_needed)
562                 rc = dt_xattr_set(env, ofd_object_child(fo), &info->fti_buf,
563                                   XATTR_NAME_FID, 0, th, BYPASS_CAPA);
564
565 stop:
566         ofd_trans_stop(env, ofd, th, rc);
567 unlock:
568         ofd_write_unlock(env, fo);
569         RETURN(rc);
570 }
571
572 int ofd_object_destroy(const struct lu_env *env, struct ofd_object *fo,
573                        int orphan)
574 {
575         struct ofd_device       *ofd = ofd_obj2dev(fo);
576         struct thandle          *th;
577         int                      rc = 0;
578
579         ENTRY;
580
581         ofd_write_lock(env, fo);
582         if (!ofd_object_exists(fo))
583                 GOTO(unlock, rc = -ENOENT);
584
585         th = ofd_trans_create(env, ofd);
586         if (IS_ERR(th))
587                 GOTO(unlock, rc = PTR_ERR(th));
588
589         dt_declare_ref_del(env, ofd_object_child(fo), th);
590         dt_declare_destroy(env, ofd_object_child(fo), th);
591         if (orphan)
592                 rc = dt_trans_start_local(env, ofd->ofd_osd, th);
593         else
594                 rc = ofd_trans_start(env, ofd, NULL, th);
595         if (rc)
596                 GOTO(stop, rc);
597
598         ofd_fmd_drop(ofd_info(env)->fti_exp, &fo->ofo_header.loh_fid);
599
600         dt_ref_del(env, ofd_object_child(fo), th);
601         dt_destroy(env, ofd_object_child(fo), th);
602 stop:
603         ofd_trans_stop(env, ofd, th, rc);
604 unlock:
605         ofd_write_unlock(env, fo);
606         RETURN(rc);
607 }
608
609 int ofd_attr_get(const struct lu_env *env, struct ofd_object *fo,
610                  struct lu_attr *la)
611 {
612         int rc = 0;
613
614         ENTRY;
615
616         if (ofd_object_exists(fo)) {
617                 rc = dt_attr_get(env, ofd_object_child(fo), la,
618                                  ofd_object_capa(env, fo));
619
620 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 50, 0)
621                 /* Try to correct for a bug in 2.1.0 (LU-221) that caused
622                  * negative timestamps to appear to be in the far future,
623                  * due old timestamp being stored on disk as an unsigned value.
624                  * This fixes up any bad values stored on disk before
625                  * returning them to the client, and ensures any timestamp
626                  * updates are correct.  LU-1042 */
627                 if (unlikely(la->la_atime == LU221_BAD_TIME))
628                         la->la_atime = 0;
629                 if (unlikely(la->la_mtime == LU221_BAD_TIME))
630                         la->la_mtime = 0;
631                 if (unlikely(la->la_ctime == LU221_BAD_TIME))
632                         la->la_ctime = 0;
633 #else
634 #warning "remove old LU-221/LU-1042 workaround code"
635 #endif
636         } else {
637                 rc = -ENOENT;
638         }
639         RETURN(rc);
640 }