Lines Matching refs:dip
264 struct inode *gfs2_lookup_simple(struct inode *dip, const char *name)
269 inode = gfs2_lookupi(dip, &qstr, 1);
301 struct gfs2_inode *dip = GFS2_I(dir);
317 if (gfs2_glock_is_locked_by_me(dip->i_gl) == NULL) {
318 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &d_gh);
342 * @dip: Directory in which dinode is to be created
349 static int create_ok(struct gfs2_inode *dip, const struct qstr *name,
354 error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC);
359 if (!dip->i_inode.i_nlink)
362 if (dip->i_entries == (u32)-1)
364 if (S_ISDIR(mode) && dip->i_inode.i_nlink == (u32)-1)
370 static void munge_mode_uid_gid(const struct gfs2_inode *dip,
373 if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir &&
374 (dip->i_inode.i_mode & S_ISUID) &&
375 !uid_eq(dip->i_inode.i_uid, GLOBAL_ROOT_UID)) {
378 else if (!uid_eq(dip->i_inode.i_uid, current_fsuid()))
380 inode->i_uid = dip->i_inode.i_uid;
384 if (dip->i_inode.i_mode & S_ISGID) {
387 inode->i_gid = dip->i_inode.i_gid;
471 * @dip: The directory this inode is being created in
478 static void init_dinode(struct gfs2_inode *dip, struct gfs2_inode *ip,
500 gfs2_init_dir(dibh, dip);
513 * @dip: The directory we are linking into
525 static unsigned gfs2_trans_da_blks(const struct gfs2_inode *dip,
529 return da->nr_blocks + gfs2_rg_blocks(dip, da->nr_blocks) +
533 static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
536 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
541 error = gfs2_quota_lock_check(dip, &ap);
545 error = gfs2_inplace_reserve(dip, &ap);
549 error = gfs2_trans_begin(sdp, gfs2_trans_da_blks(dip, da, 2), 0);
558 error = gfs2_dir_add(&dip->i_inode, name, ip, da);
562 gfs2_inplace_release(dip);
564 gfs2_quota_unlock(dip);
606 struct gfs2_inode *dip = GFS2_I(dir), *ip;
607 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
617 error = gfs2_qa_get(dip);
625 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
630 error = create_ok(dip, name, mode);
679 munge_mode_uid_gid(dip, inode);
680 check_and_update_goal(dip);
681 ip->i_goal = dip->i_goal;
691 if ((dip->i_diskflags & GFS2_DIF_INHERIT_JDATA) ||
697 ip->i_diskflags |= (dip->i_diskflags & GFS2_DIF_INHERIT_JDATA);
704 if (dip->i_diskflags & GFS2_DIF_SYSTEM)
709 if ((GFS2_I(d_inode(sdp->sd_root_dir)) == dip) ||
710 (dip->i_diskflags & GFS2_DIF_TOPDIR))
746 init_dinode(dip, ip, symname);
776 error = security_inode_init_security(&ip->i_inode, &dip->i_inode, name,
781 error = link_dinode(dip, name, ip, &da);
798 gfs2_qa_put(dip);
833 gfs2_qa_put(dip);
923 struct gfs2_inode *dip = GFS2_I(dir);
935 error = gfs2_qa_get(dip);
939 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
969 if (!dip->i_inode.i_nlink)
972 if (dip->i_entries == (u32)-1)
990 error = gfs2_quota_lock_check(dip, &ap);
994 error = gfs2_inplace_reserve(dip, &ap);
998 error = gfs2_trans_begin(sdp, gfs2_trans_da_blks(dip, &da, 2), 0);
1028 gfs2_inplace_release(dip);
1031 gfs2_quota_unlock(dip);
1038 gfs2_qa_put(dip);
1046 * @dip: the directory
1050 * Assumes that the lock on (at least) @dip is held.
1055 static int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
1063 if ((dip->i_inode.i_mode & S_ISVTX) &&
1064 !uid_eq(dip->i_inode.i_uid, current_fsuid()) &&
1068 if (IS_APPEND(&dip->i_inode))
1071 error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC);
1075 return gfs2_dir_check(&dip->i_inode, name, ip);
1080 * @dip: The parent directory
1090 static int gfs2_unlink_inode(struct gfs2_inode *dip,
1097 error = gfs2_dir_del(dip, dentry);
1127 struct gfs2_inode *dip = GFS2_I(dir);
1141 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
1173 error = gfs2_unlink_ok(dip, &dentry->d_name, ip);
1181 error = gfs2_unlink_inode(dip, dentry);