Update to latest NFSv4.2 draft 26
Fix indentation in delegrecall_impl()

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Frank S. Filz <ffilzlnx@mindspring.com>
Acked-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Acked-by: Matt Benjamin <matt@linuxbox.com>
Separate delegations from range lock lists

Delegations now use a new "struct deleg_data" instead of
state_lock_entry_t.  Since delegations always have an associated
state_t, struct deleg_data is just an extension of state_t, so they
don't exist in any list except "deleg_list" in cache inode entry to
just speed up list traversal looking for delegations.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Frank S. Filz <ffilzlnx@mindspring.com>
Acked-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Acked-by: Matt Benjamin <matt@linuxbox.com>
Remove unused sle_export_id field from state_lock_entry_t

Delegations use export_id, but now they use struct deleg_data rather
than state_lock_entry_t. So remove this unused field.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Frank S. Filz <ffilzlnx@mindspring.com>
Acked-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Acked-by: Matt Benjamin <matt@linuxbox.com>
Move delegation functions from state_lock.c to state_deleg.c

Moved remove_deleg_data, acquire_lease_lock, release_lease_lock
functions from state_lock.c to state_deleg.c. No functional change.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Frank S. Filz <ffilzlnx@mindspring.com>
Acked-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Acked-by: Matt Benjamin <matt@linuxbox.com>
Remove code that handles delegation state being there without its data object.

Delegation data object is just an extension of the delegation state, so
it should be allocated and freed along with its delegation state. One
should not exist without the other, so removed some obsolete code, and
now log LogWarn message if delegation state exists without its data
object!

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Frank S. Filz <ffilzlnx@mindspring.com>
Acked-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Acked-by: Matt Benjamin <matt@linuxbox.com>
Remove state_lock_locked and state_unlock_locked

They are only called from state_lock and state_unlock now, so there is
no reason to keep them anywhere.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Matt Benjamin <matt@linuxbox.com>
Acked-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Acked-by: Frank S. Filz <ffilzlnx@mindspring.com>
Remove redundant state/share conflict tests

The old code did THREE share conflict checks on every NFS v4 open...

The first check (which is the one retained) is a call to
state_share_check_conflict after doing a permission check for open (to
dispose of share conflicts quickly).

The second check was from state_add_impl. This check is actually insidious
because EVERY new state, whether it is a share reservation or not is checked
for conflict with every other stateid on the file. Of course the only ACTUAL
conflicts checked are between share reservations...

The final check was from either state_share_add or state_share_upgrade.

Note that we do NOT need to check differently on upgrade due to this text in RFC
3530bis in Section 9.9. Share Reservations:

This checking of share reservations on OPEN is done with no exception
for an existing OPEN for the same open-owner.

I also added a todo comment indicating that the anonymous IO temporary share
implemented with state_share_anonymous_io_start and
state_share_anonymous_io_done needs to distinguish v3 and v4 anonymouse I/O.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Acked-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Merge remote-tracking branch 'marc/update42' into next

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Use state_share_anonymous_io_start for anonymous I/O conflicts with shares

There are several sources of anonymous I/O (basically any I/O not associated
with an NFS v4 stateid). Note that SETATTR of size is considered write I/O.

Any I/O with an NFS v4 special stateid.

Any NFS v3 I/O.

The all-ones NFS v4 special stateid allows READ operations to bypass share deny
read. WRITE and SETATTR(SIZE) operations are blocked by a share deny write.

With the all-zeros NFS v4 special stateid, READ is blocked by share deny read
and WRITE or SETATTR(SIZE) is blocked by share deny write.

NSF v3 READ operations are not blocked by share deny read, but NFS v3 WRITE
and SETATTR(SIZE) operations are blocked by share deny write (so this is the
same behavior as using the NFS v4 all-ones special stateid).

Note that since NFS v3 offers share reservations via NLM_SHARE, but there is
nothing like a stateid to tie the I/O to the share reservation, we must be
generous and enforce only FS v4 share deny modes against NFS v3 I/O. NLM_SHARE
with deny modes will only block NFS v4 anonymous I/O. When processing an
NFS v4 OPEN or an NLM_SHARE, deny modes always block new share reservations
with incompatible access modes. Thus, in effect, NLM_SHARE deny modes are
just advisory locks.

This behavior may be refined in the future if NFS v3 I/O is tied to an
NLM_SHARE (for example, we could assume that any I/O coming from the same
host as an applicable NLM_SHARE is using the share, otherwise, we could
conclude such I/O should conflict with any share deny modes.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Acked-by: Malahal Naineni <malahal@us.ibm.com>
Fix a lock ABBA problem in cache_inode_lru_cleanup_try_push

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Acked-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Matt Benjamin <matt@linuxbox.com>
Backout attempt to detect sandbox builds with ganesha.nfsd -v option

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Acked-by: Malahal Naineni <malahal@us.ibm.com>
Remove a chatty LogInfo when ENOTEMPTY is converted to FSAL error code

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Merge remote-tracking branch 'ganltc/ibm_next_for_dev6' into next

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Merge remote-tracking branch 'origin/for-dev-6' into next

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Fixup checkpatch errors in nfsv41.h

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
V2.2-dev-6

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>