- int res = 0;
-
- /* Sadly, NFSD reopens a file repeatedly during operation, so the
- * "acc_mode = 0" allowance for newly-created files isn't honoured.
- * NFSD uses the MDS_OPEN_OWNEROVERRIDE flag to say that a file
- * owner can write to a file even if it is marked readonly to hide
- * its brokenness. (bug 5781) */
- if (flags & MDS_OPEN_OWNEROVERRIDE) {
- struct md_ucred *uc = md_ucred(env);
-
- if ((uc == NULL) || (uc->mu_valid == UCRED_INIT) ||
- (la->la_uid == uc->mu_fsuid))
- return 0;
- }
+ int res = 0;
+
+ /* Sadly, NFSD reopens a file repeatedly during operation, so the
+ * "acc_mode = 0" allowance for newly-created files isn't honoured.
+ * NFSD uses the MDS_OPEN_OWNEROVERRIDE flag to say that a file
+ * owner can write to a file even if it is marked readonly to hide
+ * its brokenness. (bug 5781) */
+ if (flags & MDS_OPEN_OWNEROVERRIDE) {
+ struct lu_ucred *uc = lu_ucred_check(env);
+
+ if ((uc == NULL) || (la->la_uid == uc->uc_fsuid))
+ return 0;
+ }