@@ -3490,22 +3490,20 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
3490
3490
struct dentry * dentry , const u32 * bmval ,
3491
3491
int ignore_crossmnt )
3492
3492
{
3493
+ DECLARE_BITMAP (attr_bitmap , ARRAY_SIZE (nfsd4_enc_fattr4_encode_ops ));
3493
3494
struct nfsd4_fattr_args args ;
3494
3495
struct svc_fh * tempfh = NULL ;
3495
3496
int starting_len = xdr -> buf -> len ;
3496
3497
__be32 * attrlen_p , status ;
3497
3498
int attrlen_offset ;
3499
+ u32 attrmask [3 ];
3498
3500
int err ;
3499
3501
struct nfsd4_compoundres * resp = rqstp -> rq_resp ;
3500
3502
u32 minorversion = resp -> cstate .minorversion ;
3501
3503
struct path path = {
3502
3504
.mnt = exp -> ex_path .mnt ,
3503
3505
.dentry = dentry ,
3504
3506
};
3505
- union {
3506
- u32 attrmask [3 ];
3507
- unsigned long mask [2 ];
3508
- } u ;
3509
3507
unsigned long bit ;
3510
3508
bool file_modified = false;
3511
3509
u64 size = 0 ;
@@ -3521,20 +3519,19 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
3521
3519
/*
3522
3520
* Make a local copy of the attribute bitmap that can be modified.
3523
3521
*/
3524
- memset (& u , 0 , sizeof (u ));
3525
- u .attrmask [0 ] = bmval [0 ];
3526
- u .attrmask [1 ] = bmval [1 ];
3527
- u .attrmask [2 ] = bmval [2 ];
3522
+ attrmask [0 ] = bmval [0 ];
3523
+ attrmask [1 ] = bmval [1 ];
3524
+ attrmask [2 ] = bmval [2 ];
3528
3525
3529
3526
args .rdattr_err = 0 ;
3530
3527
if (exp -> ex_fslocs .migrated ) {
3531
- status = fattr_handle_absent_fs (& u . attrmask [0 ], & u . attrmask [1 ],
3532
- & u . attrmask [2 ], & args .rdattr_err );
3528
+ status = fattr_handle_absent_fs (& attrmask [0 ], & attrmask [1 ],
3529
+ & attrmask [2 ], & args .rdattr_err );
3533
3530
if (status )
3534
3531
goto out ;
3535
3532
}
3536
3533
args .size = 0 ;
3537
- if (u . attrmask [0 ] & (FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE )) {
3534
+ if (attrmask [0 ] & (FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE )) {
3538
3535
status = nfsd4_deleg_getattr_conflict (rqstp , d_inode (dentry ),
3539
3536
& file_modified , & size );
3540
3537
if (status )
@@ -3553,16 +3550,16 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
3553
3550
3554
3551
if (!(args .stat .result_mask & STATX_BTIME ))
3555
3552
/* underlying FS does not offer btime so we can't share it */
3556
- u . attrmask [1 ] &= ~FATTR4_WORD1_TIME_CREATE ;
3557
- if ((u . attrmask [0 ] & (FATTR4_WORD0_FILES_AVAIL | FATTR4_WORD0_FILES_FREE |
3553
+ attrmask [1 ] &= ~FATTR4_WORD1_TIME_CREATE ;
3554
+ if ((attrmask [0 ] & (FATTR4_WORD0_FILES_AVAIL | FATTR4_WORD0_FILES_FREE |
3558
3555
FATTR4_WORD0_FILES_TOTAL | FATTR4_WORD0_MAXNAME )) ||
3559
- (u . attrmask [1 ] & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
3556
+ (attrmask [1 ] & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
3560
3557
FATTR4_WORD1_SPACE_TOTAL ))) {
3561
3558
err = vfs_statfs (& path , & args .statfs );
3562
3559
if (err )
3563
3560
goto out_nfserr ;
3564
3561
}
3565
- if ((u . attrmask [0 ] & (FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FSID )) &&
3562
+ if ((attrmask [0 ] & (FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FSID )) &&
3566
3563
!fhp ) {
3567
3564
tempfh = kmalloc (sizeof (struct svc_fh ), GFP_KERNEL );
3568
3565
status = nfserr_jukebox ;
@@ -3577,10 +3574,10 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
3577
3574
args .fhp = fhp ;
3578
3575
3579
3576
args .acl = NULL ;
3580
- if (u . attrmask [0 ] & FATTR4_WORD0_ACL ) {
3577
+ if (attrmask [0 ] & FATTR4_WORD0_ACL ) {
3581
3578
err = nfsd4_get_nfs4_acl (rqstp , dentry , & args .acl );
3582
3579
if (err == - EOPNOTSUPP )
3583
- u . attrmask [0 ] &= ~FATTR4_WORD0_ACL ;
3580
+ attrmask [0 ] &= ~FATTR4_WORD0_ACL ;
3584
3581
else if (err == - EINVAL ) {
3585
3582
status = nfserr_attrnotsupp ;
3586
3583
goto out ;
@@ -3592,26 +3589,26 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
3592
3589
3593
3590
#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
3594
3591
args .context = NULL ;
3595
- if ((u . attrmask [2 ] & FATTR4_WORD2_SECURITY_LABEL ) ||
3596
- u . attrmask [0 ] & FATTR4_WORD0_SUPPORTED_ATTRS ) {
3592
+ if ((attrmask [2 ] & FATTR4_WORD2_SECURITY_LABEL ) ||
3593
+ attrmask [0 ] & FATTR4_WORD0_SUPPORTED_ATTRS ) {
3597
3594
if (exp -> ex_flags & NFSEXP_SECURITY_LABEL )
3598
3595
err = security_inode_getsecctx (d_inode (dentry ),
3599
3596
& args .context , & args .contextlen );
3600
3597
else
3601
3598
err = - EOPNOTSUPP ;
3602
3599
args .contextsupport = (err == 0 );
3603
- if (u . attrmask [2 ] & FATTR4_WORD2_SECURITY_LABEL ) {
3600
+ if (attrmask [2 ] & FATTR4_WORD2_SECURITY_LABEL ) {
3604
3601
if (err == - EOPNOTSUPP )
3605
- u . attrmask [2 ] &= ~FATTR4_WORD2_SECURITY_LABEL ;
3602
+ attrmask [2 ] &= ~FATTR4_WORD2_SECURITY_LABEL ;
3606
3603
else if (err )
3607
3604
goto out_nfserr ;
3608
3605
}
3609
3606
}
3610
3607
#endif /* CONFIG_NFSD_V4_SECURITY_LABEL */
3611
3608
3612
3609
/* attrmask */
3613
- status = nfsd4_encode_bitmap4 (xdr , u . attrmask [0 ],
3614
- u . attrmask [ 1 ], u . attrmask [2 ]);
3610
+ status = nfsd4_encode_bitmap4 (xdr , attrmask [0 ], attrmask [ 1 ],
3611
+ attrmask [2 ]);
3615
3612
if (status )
3616
3613
goto out ;
3617
3614
@@ -3620,7 +3617,9 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
3620
3617
attrlen_p = xdr_reserve_space (xdr , XDR_UNIT );
3621
3618
if (!attrlen_p )
3622
3619
goto out_resource ;
3623
- for_each_set_bit (bit , (const unsigned long * )& u .mask ,
3620
+ bitmap_from_arr32 (attr_bitmap , attrmask ,
3621
+ ARRAY_SIZE (nfsd4_enc_fattr4_encode_ops ));
3622
+ for_each_set_bit (bit , attr_bitmap ,
3624
3623
ARRAY_SIZE (nfsd4_enc_fattr4_encode_ops )) {
3625
3624
status = nfsd4_enc_fattr4_encode_ops [bit ](xdr , & args );
3626
3625
if (status != nfs_ok )
0 commit comments