CREATE with EXCLUSIVE mode on RHEL NFSv3 client(RHEL6 or RHEL7) creates unexpected uid, gid ownership file even though the original file is root:root (0:0) with HP-UX NFS server.

Solution Verified - Updated -

Issue

  • CREATE with EXCLUSIVE mode on RHEL NFS client(RHEL6 or RHEL7) creates unexpected uid, gid ownership file even though the original file is root:root (0:0).
  • For example, cp command in RHEL6 or later uses O_EXCL flag when the command creates or opens a file. Trying to copy a file belongs to root:root to a NFS share sometimes causes unexpected uid or/and gid.

    • NFS client's CREATE call.

      3160 Network File System, CREATE Call DH: 0xdaf6f3a0/test.log1 Mode: EXCLUSIVE
      3161     [Program Version: 3]
      3162     [V3 Procedure: CREATE (8)]
      3163     where
      3164         dir
      3165             length: 32
      3166             [hash (CRC-32): 0xdaf6f3a0]
      3167             filehandle: 40000003ffffffff000a000000000dde59a31b72000a0000...
      3168         Name: test.log1
      3169             length: 9
      3170             contents: test.log1
      3171             fill bytes: opaque data
      3172     Create Mode: EXCLUSIVE (2)
      3173     Verifier: Opaque Data
      
    • NFS server's CREATE reply

      3280 Network File System, CREATE Reply
      3281     [Program Version: 3]
      3282     [V3 Procedure: CREATE (8)]
      3283     Status: NFS3_OK (0)
      3284     obj
      3285         handle_follow: value follows (1)
      3286         handle
      3287             length: 32
      3288             [hash (CRC-32): 0xe9e31a36]
      3289             [Name: test.log1]
      3290             filehandle: 40000003ffffffff000a0000000012366793d09c000a0000...
      3291     obj_attributes  Regular File mode: 0000 uid: 0 gid: 912711000
      3292         attributes_follow: value follows (1)
      3293         attributes  Regular File mode: 0000 uid: 0 gid: 912711000
      3294             Type: Regular File (1)
      3295             Mode: 0
      3296                 .... .... .... .... .... 0... .... .... = S_ISUID: No
      3297                 .... .... .... .... .... .0.. .... .... = S_ISGID: No
      3298                 .... .... .... .... .... ..0. .... .... = S_ISVTX: No
      3299                 .... .... .... .... .... ...0 .... .... = S_IRUSR: No
      3300                 .... .... .... .... .... .... 0... .... = S_IWUSR: No
      3301                 .... .... .... .... .... .... .0.. .... = S_IXUSR: No
      3302                 .... .... .... .... .... .... ..0. .... = S_IRGRP: No
      3303                 .... .... .... .... .... .... ...0 .... = S_IWGRP: No
      3304                 .... .... .... .... .... .... .... 0... = S_IXGRP: No
      3305                 .... .... .... .... .... .... .... .0.. = S_IROTH: No
      3306                 .... .... .... .... .... .... .... ..0. = S_IWOTH: No
      3307                 .... .... .... .... .... .... .... ...0 = S_IXOTH: No
      3308             nlink: 1
      3309             uid: 0
      3310             gid: 912711000 <---- HERE
      

Environment

  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • NFS v3
  • NFS server is HP-UX 11v3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content